How to use API Key in Open AI service call instead of Azure AD

Miguel Lopes Isidoro 51 Reputation points
2023-08-08T14:55:01.1066667+00:00

Hello,

I am having problems connecting to two endpoints in the Azure Open AI API.

  1. GET https://management.azure.com/subscriptions/subscriptionId/resourceGroups/resourceGroupName/providers/Microsoft.CognitiveServices/accounts/accountName/deployments?api-version=2023-05-01

I am getting the following error. It seems like it is expecting Azure AD authentication and a Bearer Token.

User's image

  1. POST {your-resource-name}/openai/deployments/{deployment-id}/extensions/chat/completions?api-version={api-version}

I am getting a 404 error. I am fairly sure I am using the right resource name and deployment id (my deployment name).

Can you help on solving these errors?

Thanks,

Miguel

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

1 answer

Sort by: Most helpful
  1. Miguel Lopes Isidoro 51 Reputation points
    2023-08-08T19:40:53.5266667+00:00

    Error 2 solved by changing Json to:

    {
       "dataSources":[
          {
             "type":"AzureCognitiveSearch",
             "parameters":{
                "endpoint":"https://mycongnitivesearchurl.search.windows.net",
                "key":"My search service key",
                "indexName":"my index name",
                "semanticConfiguration":"",
                "queryType":"simple",
                "fieldsMapping":null,
                "inScope":true,
                "roleInformation":"You are an AI assistant that helps people find information."
             }
          }
       ],
       "messages":[
          {
             "role":"user",
             "content":"What is the meaning of life?"
          }
       ],
       "deployment":"gpt-35-turbo",
       "temperature":0,
       "top_p":1,
       "max_tokens":800,
       "stop":null,
       "stream":true
    }
    

Your answer

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