A reply that stops mid-sentence is usually not a model error: it is the max tokens cap cutting the output short. The finish reason says so, and the fix is to raise the cap or shorten the input. A truncated reply is not a partial answer; treat it as a failed reply and run it again.
Prerequisites
- The reply that stopped mid-answer, with its finish reason.
- Access to the max tokens parameter.
- The input’s token count, so you know how much room the reply has.
Steps
Step 1: Check the finish reason
Read the finish reason on the reply. If it says the reply stopped because of the length limit, the answer is truncated; if it says the model stopped naturally, the short answer is complete and the problem is elsewhere.
Step 2: Raise the cap or shorten
Raise the max tokens cap to cover the answer you need, with a margin, or shorten the input so more of the window is left for the reply. Do one of these, not neither, and run the request again.
Step 3: Re-run and confirm
Run the request again and read the finish reason. It should now say the model stopped naturally, and the answer should be complete. If it is still truncated, raise the cap again or split the task.
Worked example: Cedar Street Library catalogue summary
The fictional Cedar Street Library asks for a catalogue summary with a 200-token cap. The reply stops mid-sentence.
| Attempt | Max tokens | Finish reason | Answer complete |
|---|---|---|---|
| 1 | 200 | Length limit | No: cut mid-sentence |
| 2 | 800 | Stopped naturally | Yes |
The 200-token cap cuts the summary short, and the 800-token cap gives a complete summary that stops naturally.
Expected result. The reply is complete and the finish reason confirms it stopped naturally, not at the limit. UNTESTED: this guide was not run against a live model or API. The worked example below is fictional practice material, and its result is the expected result, not a measured one.
Limits
- Raising the cap costs more per call; shorten the input as well when you can.
- A very long answer may need the task split, not just a higher cap.
- This guide does not cover refusals, which are a different finish reason.
