SchemaCompatibility
Target dialect for a generated JSON Schema. Structured-output modes of the major LLM providers each accept a different subset of JSON Schema; the selected value acts as a preset filter applied on top of the individual SchemaGenerationSettings knobs — the effective rule is the stricter of the knob and the dialect limit, and features the dialect rejects are never emitted regardless of the knobs.
from nutrient_sdk import SchemaCompatibilityValues
| Name | Value | Description |
|---|---|---|
SchemaCompatibility.PORTABLE | 0 | Emit only the intersection accepted by all major structured-output modes (OpenAI strict mode, Anthropic strict tool use, Gemini, and grammar-constrained local inference engines). Nullability uses type arrays, unions use anyOf, every object sets additionalProperties: false with all properties required, nesting is capped at five levels, and size constraints such as maxItems are expressed as description text instead of constraint keywords. This is the default and the safest choice when the consuming provider is not known up front. |
SchemaCompatibility.OPEN_AI | 1 | Target OpenAI Structured Outputs (strict mode). Unlocks constraint keywords OpenAI supports (minItems/maxItems, string lengths, numeric ranges, pattern) while enforcing its documented rejections (no oneOf/allOf, no patternProperties, five-level nesting cap, all properties required, additionalProperties: false). |
SchemaCompatibility.ANTHROPIC | 2 | Target Anthropic structured outputs / strict tool use. Enforces its documented rejections: no recursion, no maxItems or string-length or numeric-range constraints (expressed as description text instead), string formats limited to the documented whitelist, and additionalProperties: false on every object. |
SchemaCompatibility.GEMINI | 3 | Target Google Gemini structured output (JSON Schema path). Unions use anyOf only — Gemini silently ignores oneOf/allOf, so they are never emitted. Constraint keywords Gemini documents (minItems/maxItems, lengths, numeric ranges) are allowed. |
SchemaCompatibility.NONE | 4 | No dialect filter. The schema is shaped by the individual knobs only and may use any standard JSON Schema feature the knobs enable. Use when the schema is consumed by a validator rather than an LLM structured-output mode. |
Usage Example
from nutrient_sdk import SchemaCompatibility
# Access enum valuesvalue = SchemaCompatibility.PORTABLEprint(f"Value: {value}") # Output: Value: SchemaCompatibility.PORTABLEprint(f"Integer value: {value.value}") # Output: Integer value: 0