Source:
OpenAIon
August 6, 2024
Curated on
August 15, 2024
OpenAI has introduced a new feature called Structured Outputs in its API, designed to ensure that model-generated outputs strictly adhere to the specific JSON Schemas provided by developers. This development aims to enhance the reliability of applications built with OpenAI’s models by ensuring that outputs are consistent with a predefined structure. This feature builds on the JSON mode introduced last year, taking it a step further by guaranteeing schema adherence, which is critical for generating structured data from unstructured inputs.
In evaluations, the new GPT-4o-2024-08-06 model with Structured Outputs achieved a perfect score of 100% in adhering to complex JSON schemas, vastly outperforming previous models such as GPT-4-0613, which scored below 40%. Structured Outputs can be utilized in two key ways: first, through function calling where developers can enforce strict schema compliance within their function definitions, and second, via a new response_format parameter allowing direct schema specification without tool calling.
The new feature promises to streamline development processes by simplifying the generation of reliable and structured responses. It is compatible with all models supporting tools, including GPT-4-0613 and later versions. Additionally, OpenAI's Python and Node SDKs now support native integration with Structured Outputs, making it easier for developers to implement and utilize this feature in their applications. As always, OpenAI maintains its commitment to safety, with Structured Outputs abiding by existing safety policies and the ability to refuse unsafe requests.