Product documentationintermediate10 minutes

Use structured output

Define and validate structured AI output for a Jotsu application so model responses are predictable before application code uses them.

Use a schema when model output controls application behavior. Do not parse labels or values from prose.

Define required fields, allowed values, length limits, and nullable fields. Include an explicit uncertainty field when the workflow needs human review.

{
    "category": "billing | technical | account | other",
    "confidence": 0.0,
    "summary": "string",
    "needs_review": true
}

Validate every response before storing it or selecting an action. Log schema failures without logging sensitive prompt content, and route uncertain results to review.