Systems
Structured Output Correctness
Concept
Structured output correctness is a production boundary that converts model text into validated, typed data before any business logic runs.
System Flow
raw -> clean -> schema -> invariants -> repair -> retry -> typed_result | categorized_failure
System Implications
- Downstream services receive typed objects, not raw model strings.
- Schema validation catches structural errors early.
- Invariants capture business rules schema alone cannot express.
- Failure categories make retries and alerts operationally manageable.
Real Example
In llm-contract, `enforce(schema, run, options)` wraps model calls in a reliability boundary. The result is either validated typed output or an explicit failure object that can be logged, retried, or routed.