skip to Main Content

I’m getting "unsupported data" error when trying to send post request to Azure OpenAI. What should I do to fix the error?

https://myopenai.openai.azure.com/openai/deployments/code-davinci-002/completions?api-version=2023-03-15-preview&API-KEY=xxxxxxxxxxxx&content-type=application/json

api-version = 2023-03-15-preview
API-KEY = xxxxx
content-type = application/json


{
     "model": "gpt-3.5-turbo",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "temperature": 0.7
}

3

Answers


  1. Seems like you may be mixing davinci model in your deployment but gpt model in your body.

    I am experiencing a similar error when my model deployment is correct.
    Using gpt-35-turbo as an Azure deployment and api-key xxxx in header and api-version 2023-03-15-preview in url string.

    400 model_error
    Unsupported data type.

    Here is the payload.

    {
        "messages": [
            {
                "role": "system",
                "content": "You are an AI assistant that helps people find information."
            },
            {
                "role": "user",
                "content": "Why do some oranges have seeds and others do not?"
            }
        ]
    }
    
    Login or Signup to reply.
  2. Try to use prompt with ChatML instead.

    For example:

    {
      "prompt": "<|im_start|>systemnAssistant is a large language model trained by OpenAI.n<|im_end|>n<|im_start|>usernWhat's the difference between garbanzo beans and chickpeas?n<|im_end|>n<|im_start|>assistantn",
      "temperature": 0.9,
      "top_p": 1,
      "frequency_penalty": 0,
      "presence_penalty": 0,
      "max_tokens": 256,
      "stop": ["<|im_end|>"]
    }
    Login or Signup to reply.
  3. You are missing a chat/ in the URL. It shouldn’t be

    https://myopenai.openai.azure.com/openai/deployments/<deployment>/completions?api-version=2023-03-15-preview&API-KEY=xxxxxxxxxxxx&content-type=application/json

    but

    https://myopenai.openai.azure.com/openai/deployments/<deployment>/chat/completions?api-version=2023-03-15-preview&API-KEY=xxxxxxxxxxxx&content-type=application/json

    I was running into the same issue and it took me forever to figure out that the endpoint for the chat API is slightly different.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search