How to set correct parameters of Azure OpenAI REST API with on your data?

武田 勇 0 Reputation points
2023-09-11T06:40:41.4+00:00

I have added my data in my OpenAI playground "add your data", and enabled vector embedding, the search type is "Hybrid + semantic".

I tried to access Azure OpenAI via REST API.

The API URL is

https://xxxxxxxx.openai.azure.com/openai/deployments/my_openai_model/extensions/chat/completions?api-version=2023-08-01-preview

The "dataSources" in the API request is

{
            "type": "AzureCognitiveSearch",
            "parameters": {
                "endpoint": "https://my-cognitivesearch-endpoint.search.windows.net",
                "embeddingEndpoint": "https://my-cognitivesearch-endpoint.search.windows.net",
                "embeddingKey": "my-cognitivesearch-key",
                "key": "my-cognitivesearch-key",
                "indexName": "my-index-name",
                "inScope": "true",
                "queryType":"vectorSimpleHybrid",
                "semanticConfiguration":"default",
                "roleInformation": "role-description"
            }
}

The value of cognitive search endpoint and embedding Endpoint is same, the key is also same. (I don't know if the setting is correct)

I can do the chat in playground and get the expected answer in my data.

But when I access the API use the dataSources above, I get a error response of API version:

{'error': {'requestid': 'xxxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx', 'code': 400, 'message': '(400, \'Server responded with status 400. Error message: {"error":{"code":"","message":"Invalid or missing api-version query string parameter."}}\')'}}

I have set the OpenAI REST API version in the API URL, should I add API version parameter at other places?

Is it possible to use vector search via OpenAI REST API?

If it is yes, how resolve the api-version error above?

Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,023 questions
{count} votes

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.