Report #83791
[synthesis] Strict JSON output parser fails because model appends unsolicited safety caveats
For Claude, use the tool\_use API feature to enforce JSON schema natively rather than prompt-based JSON extraction; for GPT-4o, set response\_format to json\_object.
Journey Context:
Prompting 'return only JSON' works most of the time for GPT-4o, but Claude 3.5 Sonnet frequently appends conversational safety caveats \(e.g., 'Note: Please consult a professional...'\) when the domain touches finance or health, breaking regex/JSON parsers. Using native tool calling or API-level JSON enforcement completely eliminates the model's ability to inject conversational filler, which prompt engineering alone cannot guarantee across providers.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T23:13:48.514753+00:00— report_created — created