OpenAI Structured Output

Creator
Creator
Seonglae ChoSeonglae Cho
Created
Created
2024 Aug 7 14:56
Editor
Edited
Edited
2025 Jun 3 0:37

JSON mode

  • gpt-4-1106-preview
  • gpt-3.5-turbo-1106
response_format={         "type": "json_schema",         "json_schema": {             "name": "math_reasoning",             "schema": {                 "type": "object",                 "properties": {                     "steps": {                         "type": "array",                         "items": {                             "type": "object",                             "properties": {   "explanation": {"type":                   "string"},   "output": {"type":              "string"}                             },                             "required": ["explanation",            "output"],                             "additionalProperties":                             False                         }                     },                     "final_answer": {"type": "string"}                 },                 "required": ["steps", "final_answer"],                 "additionalProperties": False             },             "strict": True         }     }
 
 
 
 
Introducing Structured Outputs in the API
We are introducing Structured Outputs in the API—model outputs now reliably adhere to developer-supplied JSON Schemas.
Introducing Structured Outputs in the API
OpenAI Platform
Explore developer resources, tutorials, API docs, and dynamic examples to get the most out of OpenAI's platform.
OpenAI Platform
 
 

Recommendations