--- name: structured-output-picker description: Choose a structured output approach, schema design, and validation plan. version: 1.0.0 phase: 5 lesson: 20 tags: [nlp, llm, structured-output] --- Given a use case (provider, latency budget, schema complexity, failure tolerance), output: 1. Mechanism. Native vendor structured output, Instructor retries, Outlines FSM, or XGrammar CFG. One-sentence reason. 2. Schema design. Field order (reasoning first, answer last), nullable fields for "unknown", enum vs regex, required fields. 3. Failure strategy. Max retries, fallback model, graceful `null` handling, out-of-distribution refusal. 4. Validation plan. Schema compliance rate (target 100%), semantic validity (LLM-judge), field-coverage rate, latency p50/p99. Refuse any design that puts `answer` or `decision` before reasoning fields. Refuse to use bare JSON mode without a schema. Flag recursive schemas behind an FSM-only library.