RAG based ChatBot for Health Care Providers to Query Health Document with Azure AI Search and Azure OpenAI

Abhinandan Pise
3 min readMay 2, 2024

--

1. Creating Index of a Health Document

Prepare Your Health Document in ADLS:

Set Up Azure AI Search:

  • Create an Azure AI Search service in your Azure portal if you haven’t already done so.
  • Configure the data source to point to your Azure Data Lake Storage. You’ll need to provide necessary details like the storage account name, directory or folder names, and access credentials.

Create a Data Source in Azure AI Search:

  • In the Azure portal, navigate to your Azure AI Search service.
  • Create a new data source. Select “Azure Blob Storage” as the type (Azure Blob Storage APIs are used to access ADLS Gen2).
  • Specify the connection string to your ADLS and the path to where your documents are stored.

Define an Index:

  • Define the structure of the index you want to create. This includes specifying the fields that the index will contain, which can be based on the content of your health document. For instance, fields like DocumentText, Author, CreatedDate, etc.
  • Configure any specific indexing behaviors, such as text extraction from PDF files, OCR on images, or field mappings.

Create an Indexer:

  • The indexer will automatically pull data from your data source and populate the index according to the rules you’ve set up.
  • Configure the indexer with schedules if you need the indexing to be done at regular intervals (useful for continuously updated data).

Run and Monitor the Indexer:

  • Execute the indexer to start indexing documents from ADLS to Azure AI Search.
  • Monitor the status and health of the indexer through the Azure portal to ensure that documents are being indexed correctly and to troubleshoot any issues.

Query Your Index:

  • Once your documents are indexed, you can use the Azure AI Search query capabilities to search and retrieve data based on your index.

2. Source Code from GitHub

You can find the source code at: https://github.com/microsoft/sample-app-aoai-chatGPT/tree/main

Settings for the Large Language Model:
To set up the large language model, you’ll need these details:

  • AZURE_OPENAI_RESOURCE: The resource identifier for Azure OpenAI services.
  • AZURE_OPENAI_MODEL: The specific model type you want to use.
  • AZURE_OPENAI_KEY: The access key for Azure OpenAI services.

Settings for Azure AI Search:
To integrate your data with Azure AI Search, make sure to include these details:

  • AZURE_SEARCH_SERVICE: The name of your Azure Search service.
  • AZURE_SEARCH_INDEX: The name of the index where your data will be stored and searched.
  • AZURE_SEARCH_KEY: The key to access your Azure Search service.

3. Set Up a Static Web App

To set up a static web app:

  • Start by creating the web app environment on Azure from app service.
  • From the deployment center, configure it to automatically build and deploy the code. Use the specific GitHub repository and select the relevant branch for continuous updates.

--

--