json_schema is not available in Azure Open AI gpt-4o-mini 2024-07-18

Li, Lillian 35 Reputation points
2024-08-26T01:54:52.7733333+00:00

Noticed that gpt-4o-mini 2024-07-18 can support the structured json output.

But If I set the response_format to "json_schema" type, it will get below BadRequestError.

Is this new feature available in Azure OpenAI models?

If yes, how to solve the error?

BadRequestError: Error code: 400 - {'error': {'message': "Invalid parameter: 'response_format' must be one of 'json_object', 'text'.", 'type': 'invalid_request_error', 'param': 'response_format', 'code': None}}
Azure OpenAI Service
Azure OpenAI Service
An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
3,238 questions
{count} votes

Accepted answer
  1. navba-MSFT 24,985 Reputation points Microsoft Employee
    2024-08-28T05:52:55.23+00:00

    @Li, Lillian I had a discussion internally with the Product Owners.

    .

    Update (As of 18-Sept-2024):
    https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/json-mode?tabs=python

    While JSON mode is still supported, when possible we recommend using structured outputs. Like JSON mode structured outputs generates valid JSON, but with the added benefit that you can constrain the model to use a specific JSON schema.

    Setting to { "type": "json_schema", "json_schema": {...} } enables Structured Outputs which guarantees the model will match your supplied JSON schema.

    Hope this helps. If you have any follow-up questions, please let me know. I would be happy to help.

    **

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

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.