
azure-openai
#10015
invalid_parameter_error
Invalid parameter: the specified response format is not supported with the current model.
This error has been identified and solved.
Reason
The error you are encountering, specifically the 400
status error with the message "Invalid parameter: 'response_format' of type 'json_object' is not supported with this model," is due to several reasons related to the compatibility and configuration of the response_format
parameter:
Model Compatibility
The response_format
parameter set to {"type": "json_object"}
is not supported by the model you are using. Different models in the OpenAI API have varying levels of support for different response formats, and the model you are using does not support the json_object
format.
Tool Type Constraints
When using the response_format
of type json_object
or json_schema
, all tools specified in the request must be of type function
. If other types of tools, such as file_search
or code_interpreter
, are included, it will trigger this error.
This mismatch between the requested response format and the capabilities of the model or tools being used results in the 400
status error.
Solution
To fix the 400
status error due to the response_format
parameter not being supported by the model, you need to make the following adjustments:
Remove the
response_format
parameter: If the model does not support the specified response format, removing this parameter will allow the API to default to a supported format.Change the model: Switch to a model that supports the
json_object
response format, if such a model is available.Ensure tool compatibility: If using tools in your request, ensure all tools are of the type
function
when specifying ajson_object
orjson_schema
response format.
By making these changes, you can resolve the compatibility issue and successfully submit your request to the Azure OpenAI API.
Suggested Links
https://portkey.ai/error-library/prompt-error-10016
https://github.com/openai/openai-python/issues/887
https://cheatsheet.md/chatgpt-cheatsheet/openai-api-error-axioserror-request-failed-status-code-400
https://community.openai.com/t/assistants-api-why-is-json-mode-not-available-when-using-file-search-code-interpreter/743449
https://learn.microsoft.com/en-us/answers/questions/1479386/azure-openai-api-calling-issue
https://portkey.ai/error-library/invalid-argument-error-10011
https://community.openai.com/t/how-do-i-use-the-new-json-mode/475890
https://community.openai.com/t/using-response-format-in-chat-completion-throws-error/484377
https://learn.microsoft.com/fi-fi/azure/ai-services/openai/reference