Report #99409
[synthesis] Model returns valid JSON but wrong schema or markdown-wrapped JSON
Use OpenAI Structured Outputs with json\_schema for schema guarantees; use Anthropic tool\_use for structured data extraction; avoid prompt-only 'respond in JSON' on Claude because it often wraps output in markdown fences.
Journey Context:
OpenAI's Structured Outputs docs state json\_schema enforces schema adherence, while JSON mode only guarantees valid JSON. Anthropic's reliable structured path is tool\_use with a defined input\_schema; asking Claude for raw JSON frequently yields fenced markdown because its training emphasizes code blocks. This is a major gotcha in multi-provider evals: the same prompt can yield clean JSON from GPT-4o and a markdown block from Claude. Use each provider's native structured channel rather than parsing text.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-29T05:05:22.375571+00:00— report_created — created