Structured Output
Structured output is the constraint that the LLM's response conforms to a given JSON schema, guaranteeing parseable tool arguments or data extraction results without manual regex parsing.
What is Structured Output?
Structured output is the constraint that the LLM's response conforms to a given JSON schema, guaranteeing parseable tool arguments or data extraction results without manual regex parsing.
Structured output is the constraint that the LLM's response conforms to a given JSON schema, guaranteeing parseable tool arguments or data extraction results without manual regex parsing.
Where is it used?
OpenAI `response_format={"type": "json_schema", "schema": ...}`, Anthropic tool use, and `instructor` library use structured output for reliable function-calling and data extraction.
How to build it
Use `instructor.from_openai(client)` with a Pydantic model as `response_model`, call `client.chat.completions.create_with_completion(model=..., response_model=WeatherInput, ...)` to get a validated object.