OpenAI recently open sourced a collection of sample applications that demonstrate structured output capabilities, giving developers tools to build more reliable applications using language models. The repository available on GitHub contains several sample apps that demonstrate practical ways to leverage structured output in NextJS applications.
Structured output capabilities ensure that responses and tool calls conform to defined JSON schemas, bridging the gap between unpredictable model outputs and deterministic workflows. This increased reliability is essential for developers leveraging OpenAI’s advanced language models.
The sample apps cover a wide range of use cases, from simple examples to more complex implementations. One app focuses on resume extraction and shows how to display information in a structured format.
Another app explores generative UI and introduces dynamic generation of UI components using structured output. The most complex example is a conversational assistant that combines multi-turn conversations, tool calls, and generative UIs.
“Each app demonstrates a practical way to leverage this functionality to build applications with NextJS,” Team OpenAI said. The company believes this will provide a valuable resource for developers to explore and adapt their own projects.
First, the team says developers can clone the repository, configure the OpenAI API, and follow the README instructions for each sample app. OpenAI also provided additional resources, including documentation on structured output and function calls, and an introductory cookbook to get hands-on with code snippets in Python.
OpenAI welcomes contributions to improve the sample app, but notes that not all suggestions will be considered. This project is licensed under the MIT License, giving developers considerable freedom to use and modify the code for their own purposes.
Last year, OpenAI devised an update to its API with structured output, which it claims will enhance model inference by ensuring accurate and consistent compliance with the output schema. This is demonstrated by GPT-4o-2024-08-06, which achieved “100% confidence” in the evaluation, fully matching the output schema and ensuring accurate and consistent data generation.