LLMs, GenAI, RAG, agents, evaluation · insight-1509
Find where each schema constraint is enforced, because helpers may only move it into the description
- Evidence type
- documented fact
- Difficulty
- medium
- Roles
- ML engineer, Applied AI
- Industries
- cross-industry
Summary: situation, action, reason, boundary
Situation
A Pydantic or Zod model declares a fare between 0 and 5,000 and at most five itinerary items, and the team assumes provider-enforced schemas guarantee both.
Action
Read the provider's list of unsupported keywords, inspect the schema your SDK helper actually sends, confirm whether it validates the response against your original schema, and add a code check for every numeric, length and count constraint.
Reason
Anthropic documents that unsupported constraints such as minimum, maximum and length limits are removed by SDK helpers and added to the field description, and that some helpers do not validate responses.
Boundary
Structured outputs produced through SDK helpers or schema converters.
Symptom or risk
Out-of-range values reach the database because the constraint never left the client, or was stripped from the schema sent to the model, and no validation ran afterwards.
Exceptions
Constraints the provider documents as enforced, and raw requests where an unsupported keyword is rejected with an error.
Trade-offs
Validation logic is duplicated unless the checks are generated from the same model.
Pitfalls
Treating the constraint text inside the field description as enforcement.
Lessons and concepts
Claims and their sources
Anthropic's structured outputs documentation lists numerical and string-length constraints as unsupported, says SDK helpers remove them from the sent schema and add them to the field description, and says helpers differ in whether they validate the response against the original schema (as read on 2026-10-12).