Skip to main content

enforce_anthropic_strict_schema

Function enforce_anthropic_strict_schema 

Source
pub fn enforce_anthropic_strict_schema(schema: &mut BTreeMap<String, Value>)
Expand description

Patch a JSON Schema in place so it satisfies Anthropic’s strict-mode requirements: every object node gets additionalProperties: false, and every key in properties is added to required.

Anthropic rejects object schemas that omit additionalProperties, set it to true, or fail to list every property in required. OpenAI/Gemini schemas typically don’t satisfy these constraints.