GlossaryStructured output
Structured output
Structured output is a response from a language model in a defined, machine-readable format, usually JSON that follows a schema, instead of free text. It lets software read the model's answer reliably and pass it to other systems.
How it works
The application defines the shape of the answer, typically with JSON Schema, which specifies fields, types, required properties and allowed values. The schema goes to the model with the request. Many model interfaces can enforce the schema during generation, constraining the output so it always parses and matches. Others rely on instructions and examples, with the application validating the result and retrying if it fails.
Tool calling uses the same idea. The Model Context Protocol, for example, describes each tool's inputs with a JSON Schema, so the model's tool calls are structured arguments that the tool can check.
Structured output vs free text
Free text suits answers that people read. Software has to parse it, which breaks when the wording changes. Structured output suits answers that software uses: extracted fields, classifications, plans and tool arguments. Many systems ask for both, a structured result plus a short explanation field.
Why it matters
Most useful AI work in engineering feeds other software: a BOM line extracted from a datasheet, a defect class for a database, a set of parameters for a machine. Structured output makes that handoff dependable and lets guardrails validate each field. It also makes results easy to compare and store, since every answer has the same fields.
How to get it right
- Define a schema with clear field names, types, units and allowed values.
- Use enums for categories instead of free text.
- Include units in field names or as separate fields, never inside numbers.
- Validate every response against the schema and check values against business rules.
- Allow a null or unknown value, so the model does not invent data to fill a required field.
Structured output in robotics and drone hardware
Hardware teams use structured output to extract part parameters from datasheets, convert test logs into records, classify defect reports and turn change requests into structured change orders that other systems can act on. A datasheet extraction schema, for example, holds package, pin count, operating temperature range and MSL, each with units, so the result can be compared with the footprint in the design before boards are ordered.