Your extraction schema marks po_number as required. On documents with no PO number, the model invents one. What is the best fix?
Why B is the answer
Make the field nullable so the model can report it as absent
A required field pressures the model to fill it. Retries cannot help here, because the information is not in the document.
In detail
- A required field tells the model that a value must appear. When the document has none, the schema pushes it to produce something.
- Making the field nullable gives the model an honest way to report that the value is absent.
- Remember what a schema guarantees: valid shape, not correct values. Keep business checks for the values that matter.
- Tell the model when to use null, and handle null in the system that reads the output.
Use case
An illustrative scenario, not a real incident.
An accounts team extracts invoices, and po_number is required. Some invoices have none, so the model outputs a plausible number and it reaches the finance system. A nullable field returns null, and the invoice goes to a person.
See it in different ways
flowchart LR
A["Document"] --> B["Structured output"]
B --> C["Valid shape"]
C --> D{"Business checks"}
D -->|"Pass"| E["Store"]
D -->|"Fail"| F["Review queue"]flowchart LR
A["No PO number in the document"] --> B{"Field type"}
B -->|"Required string"| C["Model invents a value"]
B -->|"Nullable"| D["Model returns null"]flowchart TD
Q{"Is a PO number in the document?"}
Q -->|"Yes"| A0["Return the number"]
Q -->|"No, required field"| A1["Pressure to invent one"]
Q -->|"No, nullable field"| A2["Return null"]Key point: Give the model an honest way to say a value is missing.
Why the other options are wrong
- A. Force tool_choice to the extraction tool so the schema is always applied
- Forcing the tool makes the problem worse, because the required field still has to be filled.
- C. Lower the temperature to zero so the model stops guessing at values
- Lower temperature reduces randomness, but the schema still demands a value.
- D. Add a validation retry loop that rejects any PO number it cannot confirm
- Retrying cannot produce information that the document does not contain.

