Question 271
Scenario: Structured Data Extraction
A system extracts structured fields from messy documents, validates every output against JSON schemas, handles edge cases gracefully, and stays accurate enough to feed downstream systems.
Read the full scenario lessonA developer has a prompt engineering challenge: they need Claude to fill in a form that has 20 fields, but typically only 5-8 fields are relevant for any given request. The remaining fields should be null. Using structured output with all 20 fields as required causes Claude to hallucinate values for irrelevant fields. What schema design fixes this?