Report #94499
[synthesis] Unsolicited Caveats Break Strict Output Parsing in Claude
Use Anthropic's prefill technique by starting the assistant turn with '\{' to force immediate JSON output, and append 'Output ONLY valid JSON' to the system prompt for GPT-4o.
Journey Context:
When using raw text generation for structured data, Claude's helpfulness leads it to append conversational caveats outside the JSON block, causing json.loads\(\) to fail. GPT-4o does this less often but might add 'Sure, here is the JSON:'. Prefilling the assistant response with the opening brace forces Claude into JSON mode immediately, effectively suppressing the conversational preamble and caveats.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:12:01.605078+00:00— report_created — created