PRODUCTION SCENARIO
Coralpoint Analytics extracts line items from 40-page invoices using a strict JSON schema with max_output_tokens set to 1,500. About 4% of responses fail JSON parsing with an unexpected end of input.
What should the client check before parsing the output text?
Answering here is anonymous. Nothing is saved unless you sign in.
Show answer and explanation
Answer: Whether status is incomplete with an incomplete_details reason of max_output_tokens
Structured Outputs guarantees schema adherence only for a completed generation; when the max tokens limit is reached the response is incomplete and the partial JSON may not parse. Checking the status and incomplete_details lets the client raise the limit or fail cleanly instead of parsing a truncated object.
Official Source: https://developers.openai.com/api/docs/guides/structured-outputs ↗