LangSchema.Converter.Anthropic (LangSchema v0.7.1)
View SourceConverts a LangSchema into a JSON schema compatible with Anthropic's Structured Outputs.
Supported JSON Schema spec
Reference: https://platform.claude.com/docs/en/build-with-claude/structured-outputs
Supported types
string, number, integer, boolean, object, array, null
Supported keywords
type,description,enum(strings, numbers, bools, nulls),const,defaultproperties,required,additionalProperties(must befalse)items,minItems(only0or1)anyOf,allOf(limited —allOfwith$refnot supported)$ref,$defs,definitions(no external$ref)format(date-time,date,time,duration,email,hostname,uri,ipv4,ipv6,uuid)pattern(subset of regex — no backreferences, lookahead/lookbehind,\b)
Unsupported keywords
minimum,maximum,multipleOfminLength,maxLengthminItemsbeyond0or1,maxItemsadditionalPropertiesset to anything other thanfalse- Recursive schemas
Constraints
additionalProperties: falseis mandatory on all objects- Max 20 strict tools per request
- Max 24 optional parameters total across all strict schemas
- Max 16 parameters using
anyOfor type arrays across all strict schemas - First-request grammar compilation adds 100–300ms; cached 24 hours
LangSchema implementation status
| Keyword | Status |
|---|---|
type, description, enum | Supported |
properties, required, additionalProperties | Supported (auto-enforced) |
items, minItems | Supported |
format, pattern | Supported |
nullable | Supported (via ["type", "null"]) |
anyOf | Supported |
const, default | Not yet implemented |
$ref, $defs | Not yet implemented |
allOf | Not yet implemented |