OpenAI Unveils the Top Feature Developers Have Long Awaited

The JavaScript Object Notation (JSON) is an industry-standard file format that is both human-readable and machine-parsable, making it a popular choice for data interchange.

Despite its advantages, large language models (LLMs) often encounter challenges with JSON. They may produce hallucinated content, generate responses that only partially match instructions, or fail to parse JSON correctly. This situation frequently forces developers to employ workarounds, such as open-source tools, multiple prompts, or repeated requests, to achieve the desired output interoperability.

Structured Outputs: A Solution for Developers

Today, OpenAI has addressed these frustrations with the introduction of its Structured Outputs feature in the API. This new functionality ensures model-generated outputs align with JSON Schemas, which define the content, structure, data types, and constraints of a JSON document. OpenAI identified this feature as the most requested by developers, noting its role in enhancing consistency across applications. CEO Sam Altman even highlighted the release as being “by popular demand.”

In evaluations, OpenAI's new GPT-4o model achieved a perfect score of 100% with Structured Outputs.

This announcement follows a notable week at OpenAI, marked by the unexpected resignations of key executives John Schulman, Greg Brockman, and Peter Deng, alongside Elon Musk's ongoing legal challenges against the company, described as a “Shakespearian” betrayal of its AI mission.

Enhancing Schema Adherence with Ease

JSON serves as a flexible and widely-used format for data storage and exchange, compatible with various programming languages. OpenAI previously introduced a JSON mode for its models during last year’s DevDay to meet developer demand.

Structured Outputs empower developers to constrain OpenAI models to adhere strictly to defined schemas. OpenAI has stated this feature enhances the model's understanding of complex schemas.

“Structured Outputs represents an evolution of the JSON mode,” the company explains on its blog. “While both ensure valid JSON is produced, only Structured Outputs guarantee schema adherence.” This advancement alleviates concerns over omitted required keys or invalid enumeration values—constants in programming that simplify code maintenance.

Developers can use Structured Outputs to guide outputs step-by-step, eliminating the need to validate or resend incorrectly formatted responses. The feature allows for simpler prompts and includes explicit refusals for unsafe requests, maintaining OpenAI's commitment to safety.

Availability and Compatibility

Structured Outputs are available on GPT-4o-mini, GPT-4o, and fine-tuned versions of these models. It can be utilized with the Chat Completions API, Assistants API, and Batch API, and supports vision inputs.

OpenAI acknowledges that this new functionality draws inspiration from the excellent work of the open-source community, particularly from the outlines, jsonformer, instructor, guidance, and lark libraries.

Most people like

Find AI tools in YBX