Hi @Sanskar Singh the short answer to your question is, no.
Currently the @azure/openai
package does not support specifying multiple Azure Cognitive Search indexes in the AzureExtensionOptions
for a getChatCompletions
request. You can only specify one index per request. This means you cannot send a single request that searches across multiple indexes simultaneously regardless of data sources.
You learn about combining search results from multiple Azure Cognitive Search indexes using search filters in this Azure doc.
However, there are alternative approaches to achieve your desired functionality:
- Combine Search Results:
- Search each index individually: Use separate
getChatCompletions
calls for each relevant search index, specifying the desired index in each call. - Combine results: In your application logic, combine the results from each search by filtering and merging relevant responses based on your criteria.
- Pre-process Search Terms:
- Dynamically select index: Based on the user query or context, identify the most appropriate search index. This could involve keyword analysis, user selection, or rule-based decision making.
- Use single index search: Perform a single
getChatCompletions
call with the chosen index and the modified user query.
- Custom Azure OpenAI Implementation:
- Develop custom logic: If the above options don't meet your needs, consider creating a custom implementation using the lower-level API provided by the
@azure/openai
package. - Directly interact with OpenAI API: Utilize the OpenAI API directly, allowing more control over the request structure. This approach would require deeper knowledge of the OpenAI API and managing authentication and authorization.
Hope that helps.
-Grace