OpenAI is updating its API with support for Structured Outputs to ensure that the outputs of its models match the JSON Schemas provided by developers. 

According to OpenAI, one of the core use cases for AI today is the ability to generate structured data from unstructured inputs, but previously, developers needed to utilize open source tools, specific prompts, or just retry requests until it matched the format they were looking for. 

Structured Outputs will make this process easier by forcing the models to match the schema provided by the developers. 

Some sample use cases for using Structured Outputs include generating UIs based on user intent, separating an answer from its supporting reasoning or commentary, or extracting structured data from unstructured sources, like meeting notes or to-do lists. 

Developers can access this new functionality one of two ways. First they can set strict: true under the tool definition when writing function calls. The second option is to supply a JSON Schema using the new json_schema option in the response_format parameter. This second option is ideal for situations where the model is responding to a user rather than calling a tool.

OpenAI said that Structured Outputs follow the company’s existing safety policies, enabling the models to continue refusing unsafe requests when using this feature.

Structured Outputs is generally available in the API now. In addition, OpenAI’s Python and Node SDKs have both been updated with native support for this new functionality. 


You may also like…

Data scientists and developers need a better working relationship for AI

How to maximize your ROI for AI in software development