Share via

Azure AI avatar issues

Cloud Technicalhub 20 Reputation points
2024-01-07T09:41:40.93+00:00

I am working with azure talking avatar. I have trained the azure openai with my own data. After giving all the credentials, I am trying to ask questions. I am getting the below error.

POST

https://****.openai.azure.com//openai/deployments/lisai/extensions/chat/completions?api-version=2023-06-01-preview 400 (Bad Request)

Uncaught (in promise) Error: Chat API response status: 400

And below is my payload.

let url = "{AOAIEndpoint}/openai/deployments/{AOAIDeployment}/chat/completions?api-version=2023-03-15-preview".replace("{AOAIEndpoint}", azureOpenAIEndpoint).replace("{AOAIDeployment}", azureOpenAIDeploymentName)

let body = JSON.stringify({
     messages: messages,
     stream: true
})

fetch(url, {
   method: 'POST',
   headers: {
   'api-key': azureOpenAIApiKey,
   'Content-Type': 'application/json'
   },
   body: body
})
Azure OpenAI Service
Azure OpenAI Service

An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.

0 comments No comments
{count} votes

Answer accepted by question author
  1. Pinaki Ghatak 5,695 Reputation points Microsoft Employee Volunteer Moderator
    2024-01-07T11:52:57.0066667+00:00

    Hello @Cloud Technicalhub

    Here are a few things you could check:

    1. API Version: Ensure that the API version in your URL matches the one in the Azure documentation. You’ve mentioned api-version=2023-06-01-preview in the error and api-version=2023-03-15-preview in your code. Make sure to use the correct and latest version.
    2. Endpoint and Deployment Name: Verify that {AOAIEndpoint} and {AOAIDeployment} in your URL are being correctly replaced with your actual Azure OpenAI endpoint and deployment name.
    3. API Key: Check if the ‘api-key’ in your headers is correctly set to your Azure OpenAI API key.
    4. Request Body: Ensure that the ‘messages’ in your request body is correctly formatted and contains all the necessary information.

    If you’ve checked all of these and are still encountering the issue, it might be helpful to print out the full error message or response body (if available) for more detailed debugging information. Please remember to redact any sensitive information before sharing error logs publicly.

    If this helps, please mark this as an accepted answer, so as to help further readers who may have similar questions.


1 additional answer

Sort by: Most helpful
  1. Anthony GROLLIER-CHARTRAIN 0 Reputation points
    2024-01-08T12:01:17.56+00:00

    The error message you are seeing indicates that there is an issue with the syntax or structure of your request. The error code 400 is a standard HTTP response code that indicates that the server cannot or will not process the request due to an apparent client error <sup>12</sup>.

    Based on the error message, it seems like the issue is with the url variable in your code. The URL you are using to make the POST request is incorrect. It contains an extra forward slash (/) after the domain name. Here’s the correct URL:

    https://****.openai.azure.com/openai/deployments/lisai/extensions/chat/completions?api-version=2023-06-01-preview
    

    Please update the URL in your code and try again. If you continue to experience issues, please let me know.


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.