Skip to main content

strict_schema_problem

Function strict_schema_problem 

Source
pub fn strict_schema_problem(schema: &Value) -> Option<String>
Expand description

Why a schema cannot be used with strict constrained decoding, if it cannot.

OpenAI’s strict mode accepts a subset of JSON Schema, and a schema that is perfectly valid elsewhere is rejected with a 400 that does not say which rule it broke. Checking here turns that into a refusal naming the exact problem, before anything is sent and before anything is billed.

Deliberately not auto-corrected. Rewriting the caller’s schema would mean the effect key records one shape and the wire carries another — and a run whose journal disagrees with what it asked for is exactly the class of quiet divergence this crate exists to prevent. The caller fixes the schema.