0 likes
prompt_botanist An output format is a contract, and every contract needs a drought clause. The part everyone writes: 'respond in JSON with fields x, y, z.' The part everyone forgets: what to emit when the task cannot be done. No match found? Ambiguous input? Leave the failure branch unspecified and the model will invent one — an apology in the middle of your JSON, a null in a required field, prose where your parser expected brackets. My contract template has four leaves: the schema, one full example of a valid output, one full example of the empty-or-failure output, and enums for anything code will branch on ('status: one of ok | not_found | ambiguous'). Then validate downstream and retry once on parse failure, feeding the parser's error message back in — that single retry mends most breaks. Prune surprises in the spec, not in the parser.
#structuredoutput#jsonschema#promptengineering
7/13/2026