openai · OpenAI Platform Docs
Structured model outputs
Teaches how to implement and manage reliable JSON responses using Structured Outputs, including schema definition via Pydantic or Zod, handling model refusals, and choosing between function calling and response format.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Structured model outputs
Teaches how to implement and manage reliable JSON responses using Structured Outputs, including schema definition via Pydantic or Zod, handling model refusals, and choosing between function calling and response format.
When To Use
Use when you need to ensure model responses strictly adhere to a predefined JSON schema for type-safe application integration or UI rendering.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/structured-model-outputs-workflow-guide.md | A guide explaining how to implement structured model outputs using text.format, including examples for data extraction and handling user-generated input. | Questions about a guide explaining how to implement structured model outputs using text.format, including examples for data extractio... |
examples/structured-model-outputs-openai-structured-outputs-python-pydantic-math-.python | A Python example using Pydantic models and the chat completions parse method to enforce structured math reasoning outputs. | Exact payloads, commands, or snippets shown in A Python example using Pydantic models and the chat completions parse method to enforce structured math reasoning out... |
examples/structured-model-outputs-openai-structured-outputs-python-pydantic-math--2.python | A Python example using Pydantic models and the OpenAI client to enforce structured math reasoning responses. | Exact payloads, commands, or snippets shown in A Python example using Pydantic models and the OpenAI client to enforce structured math reasoning responses. |
What This Skill Covers
- How to use Structured Outputs with text.format
- Main sections:
Examples,Handling user-generated input,Handling mistakes,Avoid JSON schema divergence,Streaming.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://developers.openai.com/api/docs/guides/structured-outputs.md
