How to customise intents for OopenAI BYOD Retrieval

Rohan Pathak 15 Reputation points
2024-07-08T21:38:00.1733333+00:00

Hi,

If I'm using Azure OpenAI's BYOD feature, i.e. making Python requests using the 'extra_body' parameter to perform RAG on an Azure AI Search database - is there a way that I can customise the intents/queries that are used in the retrieval step? Ideally, I would use the extra_body parameter, since this would mean I still get the chunks returned as context - which is used in my application.

Looking at my searches, they do not always seem to be strictly relevant to the prompts themselves.

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
2,612 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
2,627 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. hossein jalilian 5,400 Reputation points
    2024-07-08T23:47:17.43+00:00

    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 the dataSources 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 a semanticConfiguration.
    • 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

    0 comments No comments