Report #98473
[synthesis] GPT-4o JSON mode is stricter and differently triggered than Claude's structured-output path, causing schema drift across providers
Use a provider-agnostic validator \(Pydantic, jsonschema\) on every model output regardless of whether the provider claims 'guaranteed JSON'. Treat provider JSON/structured-output modes as hints, not contracts, and always coerce before downstream use.
Journey Context:
OpenAI requires response\_format.type=json\_object and usually a system prompt mentioning JSON. Anthropic recommends pre-filling the assistant response or using tools for reliable structure. Neither guarantees schema conformance, and both can emit markdown fences, trailing commas, or extra explanatory text. Portability failures happen when teams skip post-validation on the 'safe' provider. A single canonical schema plus strict validation is cheaper than debugging drift in production.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-27T05:02:04.497628+00:00— report_created — created