Handling a refusal in an OpenAI strict structured output
OAI-SE
Structured Outputs & Strict JSON Schemas
Medium
Question 12 of 24
Aldergate's intake service requests a strict structured object for insurance claims. On a small share of documents the response carries a refusal instead of the claim object, and the parser throws.
Which check should the client make before reading the claim fields?
Show answer and explanation
CBranch on the refusal property before reading any business field value
A refusal is a separate, programmatically detectable outcome: the output carries a refusal property in place of the requested object, so the client branches on that before touching any business field. A refused response still completes, so status says nothing useful; output_text can be empty for a truncated response as well as a refused one; and a parse failure is a symptom shared with truncation rather than a cause.
Source: developers.openai.com/
Anonymous, no account needed. Your tally stays in this browser.
Practice by topic: Prompt engineering questions