openai.BadRequestError: Unrecognized request argument supplied: response_format

Ruslan Levond 20 Reputation points
2024-01-23T18:48:27.9933333+00:00

Following Python example in Learn How to use JSON docs, returns the following error -

openai.BadRequestError: Error code: 400 - {'error': {'message': 'Unrecognized request argument supplied: response_format', 'type': 'invalid_request_error', 'param': None, 'code': None}}

It seems like the argument does get recognised because when changing "json_object" to "asd", API returns a different kind of error -

openai.BadRequestError: Error code: 400 - {'error': {'message': "'asd' is not one of ['json_object', 'text'] - 'response_format.type'", 'type': 'invalid_request_error', 'param': None, 'code': None}}

Is this a potential bug or documentation is incorrect?

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

Accepted answer
  1. Saurabh Sharma 23,796 Reputation points Microsoft Employee
    2024-01-23T21:44:26.12+00:00

    Hi @Ruslan Levond Welcome to Microsoft Q&A! Thanks for posting the question. I have tried the Python example code you are referring to and got the results correctly with GPT-4-1106 preview model version. (see screenshot below)User's image User's imageWhich model you are trying to use? Also, which openai package version you are using? I have tried with openai version 1.9.0.

    User's image

    Thanks

    Saurabh

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Ruslan Levond 20 Reputation points
    2024-01-24T11:46:05.69+00:00

    Thanks Saurabh, I was using the wrong deployment which had the old version of the model.


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.