OpenAI's new models gpt-4o-2024-08-06 and gpt-4o-mini beg... | OpenAI's new models gpt-4o-2024-08-06 and gpt-4o-mini beg...
OpenAI's new models gpt-4o-2024-08-06 and gpt-4o-mini begin to support structured output. Unlike the previous JSON mode, the current structured output can not only define the JSON Schema, but also ensure that the output JSON is 100% correct.

Some limitations:

1. Only a part of JSON Schema is allowed: String, Number, Boolean, Object, Array, Enum, anyOf, oneOf and allOf are not supported, which is enough for normal use

2. All fields are required and cannot be optional

3. The nesting cannot exceed 5 levels and cannot exceed 100 attributes

4. Some reserved words cannot be used as attribute names, such as string types cannot use minLength, maxLength, etc.

5. The first API response with a new Schema will generate additional delays, which will be cached later. The general delay will not exceed 10 seconds, but complex Schemas may require up to a minute of preprocessing time

6. Structured output does not prevent all types of model errors. For example, the model may still make mistakes in the values ​​of the JSON object (e.g., a wrong step in a math equation). If errors are made, it is recommended to provide examples in the prompt words or split the task into simpler subtasks.

Original article: https://openai.com/index/introducing-structured-outputs-in-the-api/ Introducing Structured Outputs in the API