Read a response envelope
A response envelope contains output plus metadata such as completion status and usage. Inspect the finish reason before treating partial output as a complete answer.
Understand the pattern
A response envelope contains output plus metadata such as completion status and usage. Inspect the finish reason before treating partial output as a complete answer.
Interpret the evidence
Treat length termination as potential truncation and review the output budget.
A tempting mistake
Nonempty output always means the answer is complete.
All names, measurements, prices, versions, and thresholds in this exercise are fictional training data. The evidence supports this bounded scenario, not a claim about a live provider.
Worked example and expected result
$ cat /opt/ai-lab/cases/aiops-inference-apis-004.json{
"fixture": "Fictional training data; not a live measurement.",
"finish_reason": "length",
"output_present": true,
"complete_answer": false
}Exit status: 0. The command completed successfully in the training fixture.
$ jq .finish_reason /opt/ai-lab/cases/aiops-inference-apis-004.json"length"
Exit status: 0. The command completed successfully in the training fixture.
$ printf '%s\n' 'review-truncation' > /home/learner/lab/aiops-inference-apis-004-decision.txt(no output; exit 0)
Exit status: 0. The command completed successfully in the training fixture.
Explain it
Apply it elsewhere
Keep the momentum.
Complete the lab, then explain and apply the pattern.
Next: Inspect token usageTry an incident drillAnonymous lesson and mastery progress lasts for this session. Sign in to keep synced lesson XP between sessions; mastery stays device-local. No speed bonus, lost lives, or hint penalties.
Keep learning
- 01Read a request envelopeA request envelope combines model selection, messages and generation constraints. Invalid field types should be corrected at the contract boundary before retrying.Practice
- 02Inspect token usageUsage accounts for input and generated tokens separately. Compare the sum with the recorded total and keep the tokenizer/model context with any estimate.Practice
- 03Distinguish client and server errorsClient and server status classes point to different boundaries. A malformed request calls for correction, while a transient server failure may warrant a bounded retry policy.Practice