Study FAQ
How should a Claude extraction contract represent missing, unclear and out-of-taxonomy values?
Also asked as 2
- When should Claude return null, omit a field, or use other or unclear during extraction?
- How do I design missing-value rules that avoid forcing Claude to invent required facts?
Answer
Choose an explicit missingness policy that the schema and consumer both support. Required presence, a nullable value, an omitted optional field, an unclear classification and a known out-of-taxonomy category describe different states. None should be replaced with an invented fact merely to satisfy a required field.
For a required nullable founding_year, the key must exist and null can record that the supplied document states no year. Under a different contract where founding_year is optional but non-nullable, omission is allowed while a present null is invalid. A string such as “unknown” cannot substitute for an integer field. Select one policy deliberately and validate it with the schema features supported by the actual output interface.
Use unclear when the evidence is insufficient to choose a category. Use other when the document's meaning is known but falls outside the standard taxonomy, and retain a meaningful detail. Enforce any relationship between category and detail in the supported schema or application checks. Description text and correlated examples alone do not enforce it.
For a memo stating only “Acme Services,” retain the company name and the approved missing-year representation. If a later authorized lookup supplies a year, keep that enrichment with its separate source; it did not become a fact stated by the memo. Preserve raw ambiguous dates or units until their interpretation is established rather than normalizing a guess.
Distinguish genuine source absence from unreadable input, denied access, ambiguity and a present value the extractor missed. Those conditions need different next steps. A valid empty entity list can represent no supported entities under its declared contract; a missing response or malformed payload is an extraction failure. Validate both shape and source support before advancing.
Claude structured-output contracts and schema limits · Grounding and uncertainty guidance
Full explanation
Enforce structured output using tool use and JSON schemas
Learning material · CCAR-F
Read the full explanation