Forum Discussion

Masaru_Matsumura's avatar
Masaru_Matsumura
Copper Contributor
Apr 24, 2024

How to build a RAG system using AzureOpenAI and AzureAISearch.

I want to build a RAG system using AzureOpenAI and AzureAISearch.
I am currently struggling with the on your data feature of AzureOpenAI to adjust the field composition of the uploaded files.
The uploaded file has two fields, a question field and a content field, but the field structure of the index created summarizes all the information about the contents of the file in the content field.
Therefore, when a particular question is asked from AzureOpenAI, multiple questions and answers are output, summarized in the content field. This is not the expected result.
The expected result is that a specific question should return one answer to a specific question.
Perhaps to do this I need to edit the json in the index field, but I am having difficulty understanding how to do this.
If anyone has any knowledge of this, please let me know.
Thank you.

1 Reply

  • Try on below:

     

    • Understand the Data Ingestion Process: When you upload files using the "on your data" in AzureOpenAI, the data is chunked and embedded into an Azure AI Search instance. This process involves creating an index that stores the data in a searchable format.
    • Define Field Mappings: To ensure that your question and content fields are correctly mapped, you may required to define explicit field mappings in your index. This can be done using the Azure AI Search indexer. Below in JSON:
    {
      "name": "your-index-name",
      "fields": [
        {
          "name": "question",
          "type": "Edm.String",
          "searchable": true,
          "filterable": true,
          "sortable": true,
          "facetable": false
        },
        {
          "name": "content",
          "type": "Edm.String",
          "searchable": true,
          "filterable": false,
          "sortable": false,
          "facetable": false
        }
      ],
      "suggesters": [],
      "scoringProfiles": [],
      "defaultScoringProfile": null,
      "corsOptions": null,
      "analyzers": [],
      "tokenizers": [],
      "tokenFilters": [],
      "charFilters": []
    }
    
    • Adjust the Indexer Configuration: Ensure that the indexer configuration correctly maps the source fields (question and content) to the target fields in the index. You can use the Azure AI Search portal or the REST API to configure the indexer.
    • Test the Configuration: After setting up the index and indexer, test the configuration by querying the index with specific questions. Ensure that the responses are as expected, with each question returning a specific answer.
    • Optimize the Retrieval Process: Fine-tune the retrieval process by adjusting the query parameters and relevance scoring. This will help improve the accuracy of the responses.

Resources