Structured Outputs feature introduced to the API
Key point
OpenAI has introduced a Structured Outputs feature to the API that ensures model outputs perfectly comply with developer-provided JSON schemas.
Details
The existing JSON mode helps the model generate valid JSON, but there was no guarantee that it would perfectly comply with a specific schema. This forced developers to use workarounds such as improving prompting or repeatedly retrying requests.
The newly introduced Structured Outputs ensures that the model's output exactly matches the JSON Schema provided by the developer. OpenAI conducted separate training so that the model could better understand complex schemas, and applied constraints to make the model strictly follow the schema.
According to performance test results, the new model, gpt-4o-2024-08-06, recorded 100% accuracy in a complex JSON schema compliance evaluation. This is an overwhelming figure compared to gpt-4-0613, which scored under 40%.
This feature can be used via Function calling, and can be activated by setting strict: true within the tools definition. It is supported on all models after gpt-4-0613 and gpt-3.5-turbo-0613.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.