How to use Azure OpenAI to process multiple files

Maninder Singh 20 Reputation points
2023-12-15T18:14:26.0433333+00:00

I have 3 to 4 files on different topics. I have uploaded the files and indexed their names. I am using the curl (API endpoint) to query them. How can I manage user queries with multiple files? I tried to pass multiple indexes, but I got the error shown below. Please give me a solution. Thanks.


  {
  "dataSources": [
    {
      "type": "AzureCognitiveSearch",
      "parameters": {
        "endpoint": "",
        "key": "",
        "indexName": "nhcrfaq"
      }
    },
    {
      "type": "AzureCognitiveSearch",
      "parameters": {
        "endpoint": "",
        "key": "",
        "indexName": "w3school"
      }
    }
  ],
  "messages": [
      {"role":"system","content":"You are an AI assistant that helps people find information.","index":0,"end_turn":false},{"role":"user","content":"what is plan today?","index":0,"end_turn":false}]
}
  
 "message": "Validation error at #/dataSources: List should have at most 1 item after validation, not 2"
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,285 questions
0 comments No comments
{count} votes

Accepted answer
  1. Saurabh Sharma 23,761 Reputation points Microsoft Employee
    2023-12-15T19:33:59.1566667+00:00

    Hi @Maninder Singh

    Welcome to Microsoft Q&A! Thanks for posting the question.

    The reason for this error is that you can only add one index at a time when using your own data. Adding multiple indexes is not supported.

    If you want to query multiple files with different topics, you have either Embeddings or Azure Cognitive Search approach as described in this document.

    • Azure Cognitive Search approach: You can create a single index for all your files and use the queryType parameter to specify the type of search you want to perform. You can also use the facets parameter to filter the results by topic or other criteria.
    • Embeddings Approach: Use the embeddings approach with a single index and a single embedding model. You can choose a general-purpose embedding model, such as text-embedding-ada-002, that can handle different topics and domains. You can also add a topic column to your files and use it as a metadata field in your index. This way, you can use the filter parameter to narrow down the results by topic or other criteria.

    Hope this help.

    Please let me know if you have any questions.

    Thanks

    Saurabh


    Please 'Accept as answer' and Upvote if it helped so that it can help others in the community looking for help on similar topics.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful