OpenAI API Update Guarantees Perfect JSON Schema Matching

OpenAI introduces Structured Outputs for its API to ensure AI responses match exact developer schemas. The new feature achieves perfect adherence rates in testing and simplifies building complex workflows.

OpenAI introduces a new API feature called Structured Outputs that forces model responses to conform exactly to developer-supplied JSON Schemas. This upgrade solves a major limitation of the previous JSON mode by strictly constraining the AI to match specific format requirements rather than just producing valid JSON code.

The newest model, GPT-4o-2024-08-06, achieves a perfect 100% score when evaluated on complex schema adherence, compared to a less than 40% success rate for the older GPT-4-0613 model. Developers access this capability by setting strict to true within function definitions or by using a new response_format parameter option.

This feature works with all models that support tools, including various GPT-4 and GPT-3.5-turbo versions, and comes with native support in the updated Python and Node SDKs. OpenAI also builds in safety measures that prompt the model to refuse unsafe requests and return a specific refusal string for easy detection within application logic.

Read More at the original source →