Claude Certified Architect – Foundations Practice Question 35: Structured Output Validation
Claude Certified Architect, Foundations · Test 4 · question 5 of 10
A pipeline asks Claude to extract invoice data as JSON that is parsed by downstream code. About 2% of responses fail parsing or miss required fields, and each failure breaks a nightly job. The team wants the most reliable fix. Which approach is best?
Show answer and explanation
Answer:
Structured outputs constrain generation to a supplied JSON schema, which removes most format failures. Schema validation in your own code remains the safety net (for example for semantic checks and for refusals or truncation by max_tokens), and retrying with the validation error fed back gives the model concrete information to fix the problem.
A is only a prompt instruction with no guarantee. B reduces variance but does not guarantee conformance to a schema. D uses a model to check format that a deterministic validator checks more cheaply and reliably, and the second call can be wrong too.
Reference: Structured outputs