Structured output
Setresponse_format to a json_schema with a name and a schema. The response text conforms to the schema unless generation is cut short. The example below builds the schema from a Pydantic model and validates the response against it:
Next steps
Keep context
Carry state across multiple turns.
Output Control
Streaming, background runs, error handling, and full structured-output examples.