Hello Rohan Pathak,
Thanks for posting your question in the Microsoft Q&A forum.
Here's how you can approach this:
- Azure AI Search supports various query types that you can specify in the
extra_body
parameter. you can modify thedataSources
section to include a custom query. For example:extra_body = { "dataSources": [ { "type": "AzureCognitiveSearch", "parameters": { "endpoint": your_search_endpoint, "key": your_search_key, "indexName": your_index_name, "queryType": "simple", "searchFields": "title,content", "filter": "category eq 'relevant_category'", "inScope": True, "roleInformation": "You are an AI assistant specialized in...", "strictness": 3, "topNDocuments": 5, "semanticConfiguration": "default", "queryType": "semantic" } } ] }
- If you want more contextually relevant results, consider using semantic search by setting
queryType
to "semantic" and specifying asemanticConfiguration
. - If your search index has custom scoring profiles, you can specify them in the query to influence relevance.
- Adjust the
strictness
parameter to control how closely the retrieved documents should match the query.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful