OAI-SE Structured Outputs & Strict JSON Schemas MEDIUM
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.
Free

Keep practicing OAI-SE

undefined original OAI-SE practice questions, each with an explanation and a source link. No account needed.

Start free practice set → Timed, explained, free