JSON Mode
An output constraint flag provided by LLM APIs that requires the model to produce valid JSON on every response. It represents a hard requirement on the model's structured output capability and is commonly used in conjunction with tool-calling scenarios.
Core Facts
Timeline (last 90 days)
Specifying an exact JSON output schema for the Agent (field names, types, enum values) ensures downstream systems parse without errors and forces the model to quantify uncertainty.
The author adopts a three-layer approach to solve the problem of unreliable AI output: forcing JSON mode, cleanValue to clean placeholder values, and post-processing array filtering of invalid values.
JSON mode and structured output only solve the problem of format validity; they do not guarantee semantic correctness and do not provide calibrated confidence, so they cannot support threshold policies.
All Facts (4)
JSON Mode only guarantees that the output is valid JSON without constraining the field structure; Structured Outputs enforces output conforming to a predefined JSON Schema at the syntactic level by applying a finite state machine (FSM) to constrain the token sampling path during the decoding phase.
65%UnverifiedSpecifying an exact JSON output schema for the Agent (field names, types, enum values) ensures downstream systems parse without errors and forces the model to quantify uncertainty.
50%UnverifiedThe author adopts a three-layer approach to solve the problem of unreliable AI output: forcing JSON mode, cleanValue to clean placeholder values, and post-processing array filtering of invalid values.
50%UnverifiedJSON mode and structured output only solve the problem of format validity; they do not guarantee semantic correctness and do not provide calibrated confidence, so they cannot support threshold policies.
50%