Report #94655
[synthesis] Claude adds conversational filler outside JSON or wraps it in markdown despite strict prompts
Use Anthropic's tool\_use API with a dummy tool to force strict JSON schema adherence, even if you aren't calling a real function. For GPT-4o, use Structured Outputs with response\_format.
Journey Context:
Prompting Claude to 'only output JSON' often fails because its RLHF training strongly favors being helpful and conversational. GPT-4o's JSON mode ensures valid JSON but not schema adherence. The cross-model insight is that native tool-calling endpoints are the only reliable way to enforce strict JSON schemas across both providers, but the implementation diverges: Anthropic requires a tool definition, while OpenAI uses response\_format.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T17:27:43.207344+00:00— report_created — created