A response that matches a JSON schema is easier for software to consume, but its contents can still be wrong. The model may choose a valid category for the wrong reason, supply an existing identifier for the wrong customer or produce a well-formed date unsupported by the source. Treat structured output as an interface contract. Add separate checks for meaning, evidence and permission before the result affects another system.
Design fields around downstream decisions
Start with the application that will consume the output. Define only the fields it needs, with clear descriptions and constrained choices where appropriate. A routing task may need a category, supporting excerpt and unresolved questions. Avoid requesting a large general-purpose object whose fields have no operational use, because extra surface area creates more opportunities for ambiguous interpretation.
Represent uncertainty explicitly. An optional identifier, unknown status or review-required outcome is preferable to forcing the model to invent a value. Decide how absent, null and empty values differ. These conventions should be understood by the receiving application so missing evidence cannot accidentally become an instruction to clear an existing record.
Validate structure and meaning separately
Structured-output features can constrain responses to a supported schema, as described in OpenAI's documentation. The application should still handle refusals, interruptions and other outcomes that do not provide the expected business result. A successful transport response is not the same as a completed task. Make these states visible rather than hiding them inside generic parsing errors.
After structural checks, validate identifiers against authoritative records and apply ordinary business rules. Confirm that a proposed date falls within the permitted period or that a referenced order belongs to the selected account. Keep exact calculations outside the language model when possible. These checks should reject or route questionable results without silently repairing them into something that merely looks plausible.
Keep evidence close to the proposed value
For extracted or classified information, retain the source text or record reference that supports the result. A reviewer should be able to inspect why a field was proposed. Evidence links also help distinguish a model mistake from an ambiguous input. Do not accept a free-form explanation as proof if it cannot be checked against the actual source.
Use a small set of deliberate failure cases during testing. Include a valid-looking but nonexistent identifier, an unsupported category implication and contradictory source values. Verify that the application catches the relevant issue even when the output is perfectly formatted. This tests the boundary that schemas cannot establish by themselves.
Version the contract deliberately
Treat changes to field names, allowed values and meanings as interface changes. Update consumers and evaluation cases together. A new category can break a downstream rule even if the schema remains syntactically valid. Preserve the contract version with stored outputs so older results can be interpreted correctly during investigation or replay.
Before enabling an action, require the combined result of structural validity, business validation and authorisation. Route failures to a useful exception view containing the proposed values and evidence. This produces an integration that remains understandable when the model is uncertain or wrong, while retaining the efficiency of machine-readable responses for the cases that pass.
The key decisions.
- Use schemas as interface contracts, not factual guarantees.
- Validate identifiers and business rules against authoritative systems.
- Preserve uncertainty, evidence and contract versions through downstream processing.
Sources & further reading
Primary references for the concepts discussed. Check the applicable documentation when planning implementation.







