Chat with Azure OpenAI models using your own data facing issue data Unrecognized request argument supplied: dataSources

Saurabh Upadhya 25 Reputation points
2023-07-10T15:27:55.18+00:00
contain data source  information  i tired to add data source information json is give  error
{
    "error": {
        "message": "Unrecognized request argument supplied: dataSources",
        "type": "invalid_request_error",
        "param": null,
        "code": null
    }
}
i passed data

    "dataSources": [
        {
            "type": "AzureCognitiveSearch",
            "parameters": {
                "endpoint": "https://xyz.search.windows.net",
                "key": "*********YWsWRK8lMu8mtYSAzSeBmhdOT",
                "indexName": "azureblob-index"
            }
        }
    ]
please guide me what endpoint and   key should i  pass ? 
thanks in advance
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,042 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Alexa Kiss 0 Reputation points Microsoft Employee
    2023-10-13T09:05:52.13+00:00

    Hi,
    I got it work based on this document
    https://learn.microsoft.com/en-us/azure/ai-services/openai/use-your-data-quickstart?tabs=command-line&pivots=rest-api

    deployment_id = 'deployment-gpt-3-5'
    
    request.url = f"{openai.api_base}/openai/deployments/{deployment_id}/extensions/chat/completions?api-version={openai.api_version}"
    
    #use the above URL in the setup_byod function
    def setup_byod(deployment_id: str) -> None: ....
    
    
    
    def completion(deployment_id: str, prompt_input: str):
          
    	completion = openai.ChatCompletion.create(             
    		deployment_id=deployment_id,         
    		dataSources=[              
    			{   "type": "AzureCognitiveSearch",	
    				"parameters": {                     
    					"endpoint": search_endpoint,                     
    					"key": search_key,                     
    					"indexName": search_index_name,
                     	}             
    			}         
    		],        
    		messages=[{"role": "user", "content": prompt_input}]
    	)     
    	print(completion['choices'][0]['message']['content'])
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.