OpenAI Structured Output

Created
Created
2024 Aug 7 14:56
Editor
Creator
Creator
Seonglae Cho
Edited
Edited
2025 Jan 16 13:29
Refs
Refs
Zod

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 } }
 
 
 
 
 
 
 

Recommendations