VOOZH about

URL: https://thenewstack.io/openais-chatgpt-now-formats-output-to-developer-queries/

⇱ OpenAI's ChatGPT Now Formats Output to Developer Queries - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2024-08-07 12:00:58
OpenAI's ChatGPT Now Formats Output to Developer Queries
sponsor-boomi,sponsored-topic,
API Management / Data / Large Language Models

OpenAI’s ChatGPT Now Formats Output to Developer Queries

Bonus: Structured Outputs also significantly increases the the reliability of ChatGPT's answers over those from prompts alone.
Aug 7th, 2024 12:00pm by Joab Jackson
👁 Featued image for: OpenAI’s ChatGPT Now Formats Output to Developer Queries

OpenAI, the company behind the popular ChatGPT Large Language Model Generative AI service, has released a tool that will return query results in the exact format specified by users.

This has been the most-asked for request among developers using the AI technology, according to the OpenAI CEO Sam Altman.

Since its debut in November 2022, the ChatGPT service has been harnessed by countless application developers for agent-driven and other apps. But while ChatGPT uses troves of unstructured data to deliver its results (via API-driven function calling), application developers would far prefer to have these results delivered as structured data, so they can be better parsed by their respective apps.

Last year, OpenAI expanded its API to include results delivered in JSON. This week, the company goes one step farther, revealing a new API feature called Structured Outputs, which will deliver the results in whatever JSON schema the developer specifies in the query.

“Developers have long been working around the limitations of LLMs […] via open source tooling, prompting, and retrying requests repeatedly to ensure that model outputs match the formats needed to interoperate with their systems,” wrote Michelle Pokrass, OpenAI technical staff member, in a blog item posted Tuesday.

“Structured Outputs solves this problem by constraining OpenAI models to match developer-supplied schemas and by training our models to better understand complicated schemas.”

How Structured Outputs Improves LLM Quality

Structured outputs differ from those generated by plain user prompts in that they are constrained as to what information they can provide, a technique known as “constrained sampling” or “constrained decoding.”

“In order to force valid outputs, we constrain our models to only tokens that would be valid according to the supplied schema, rather than all available tokens,” Pokrass explained.

For ChatGPT, this additional step of filling in the schema improves its accuracy.

The OpenAI developers found in tests that ChgatGPT was able to fill a pre-defined schema correctly 100% of the time, but would only provide the correct responses 85% of the time through plain prompts.

👁 OpenAI chart comparing the reliability of ChatGPT responses generated for JSON schemas versus those generated from the command prompt.

OpenAI chart comparing the reliability of ChatGPT responses generated for JSON schemas versus those generated from the command prompt.

How to Produce Structured Outputs

Now, when their apps submit a request, developers supply a JSON schema, via json_schema, which is a new option for the response_format parameter. The strict value must be set as “true” within the function definition. The model’s output would then best match its answers to the schema (this works both for AI tools and for direct user inquiries).

The responses will still abide by OpenAI’s safety requirements — which blocks potentially harmful content — and will return a refusal string value to questions it won’t answer. And there are other limitations as well: It supports only a subset of the JSON schema. It won’t prevent mistakes in model definition, and there is an additional latency in the first response, as the ChatGPT sorts out the developer’s schema.

Both the Node.js and Python software development kits from OpenAI have been updated with the new response_format parameter.

The biggest possible use case is, of course, formatting unstructured data into structured data, so it can be ingested and analyzed by a relational database system. which has long been a challenge for organizations with lots of information stashed away in office documents.

But Pokrass elaborates on some possible advanced uses of the technology, including creating user interfaces on the fly based on user input and providing a single answer without the supporting material.

This is a “great feature and much needed,” machine learning researcher Elvis Saravia noted on X. Saravia worked up a tutorial for YouTube on how to use Structured Outputs:

Boomi powers the future of business with intelligent integration and automation. As a category-leading, global SaaS company, Boomi celebrates more than 20,000 customers and 800 partners who use Boomi to connect their applications, data, and people. For more information, visit boomi.com.
Learn More
TRENDING STORIES
Joab Jackson is a senior editor for The New Stack, covering cloud native computing and system operations. He has reported on IT infrastructure and development for over 30 years, including stints at IDG and Government Computer News. Before that, he...
Read more from Joab Jackson
SHARE THIS STORY
TRENDING STORIES
TNS owner Insight Partners is an investor in: OpenAI.
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
👁 Image
To benefit from AI, effective API management is crucial. Our guide covers 5 key points to make your business AI-ready.