Report #76662
[synthesis] Models handle stop sequences differently leading to truncated JSON or runaway responses
Use multi-character, highly distinct stop sequences \(e.g., \\n\\n---\\n\\n\) instead of single characters like \}, and always check the finish\_reason to handle truncation.
Journey Context:
Single-character stop sequences often fail because the model might naturally generate that character in its thought process. Claude is especially prone to ignoring them if they interrupt a logical flow, while GPT-4o stops immediately but might truncate mid-JSON. Gemini might hit max tokens without clearly indicating truncation. Using distinct sequences and checking finish reasons ensures cross-model reliability.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:16:02.458424+00:00— report_created — created