Resources / Schema library

Pre-built JSON Schema guardrails

Paste any template into Schema Rules to start validating model output on the proxy. Every template is strict by default — unknown keys and missing fields are flagged before the response reaches your app.

7 of 7 templates

Summary with citations

Structured Outputs

Strict summary object with required citation array and bounded confidence score.

structured-summary.json
{
"name": "summary_with_citations",
"strict": true,
"schema": {
"type": "object",
"additionalProperties": false,
"required": ["summary", "citations", "confidence"],
"properties": {
"summary": { "type": "string", "maxLength": 1200 },
"citations": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["source_id", "quote"],
"properties": {
"source_id": { "type": "string" },
"quote": { "type": "string" }
}
}
},
"confidence": { "type": "number", "minimum": 0, "maximum": 1 }
}
}
}
#summary#citations#strict

Single tool invocation

Function Calling

Guards a tool name against an enum and validates the argument bag shape.

tool-call.json
{
"name": "tool_invocation",
"strict": true,
"schema": {
"type": "object",
"additionalProperties": false,
"required": ["tool", "arguments"],
"properties": {
"tool": {
"type": "string",
"enum": ["search_docs", "create_ticket", "send_email"]
},
"arguments": { "type": "object" },
"reasoning": { "type": "string", "maxLength": 400 }
}
}
}
#tools#enum#arguments

Multi-step tool plan

Function Calling

Ordered plan of tool calls with dependency ids — catches truncated plans early.

tool-plan.json
{
"name": "tool_plan",
"strict": true,
"schema": {
"type": "object",
"additionalProperties": false,
"required": ["steps"],
"properties": {
"steps": {
"type": "array",
"minItems": 1,
"maxItems": 10,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["id", "tool", "arguments"],
"properties": {
"id": { "type": "string" },
"tool": { "type": "string" },
"arguments": { "type": "object" },
"depends_on": { "type": "array", "items": { "type": "string" } }
}
}
}
}
}
}
#agents#plan#array

Invoice extraction

Extraction

Line items, totals and ISO dates with nullable fields instead of hallucinated values.

invoice-extraction.json
{
"name": "invoice_extraction",
"strict": true,
"schema": {
"type": "object",
"additionalProperties": false,
"required": ["invoice_number", "issued_at", "currency", "line_items", "total"],
"properties": {
"invoice_number": { "type": ["string", "null"] },
"issued_at": { "type": ["string", "null"], "format": "date" },
"currency": { "type": "string", "pattern": "^[A-Z]{3}$" },
"line_items": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["description", "quantity", "unit_price"],
"properties": {
"description": { "type": "string" },
"quantity": { "type": "number", "minimum": 0 },
"unit_price": { "type": "number", "minimum": 0 }
}
}
},
"total": { "type": "number", "minimum": 0 }
}
}
}
#documents#invoice#nullable

Contact & entity extraction

Extraction

Emails and phone numbers validated by pattern so downstream jobs never break.

contact-extraction.json
{
"name": "contact_extraction",
"strict": true,
"schema": {
"type": "object",
"additionalProperties": false,
"required": ["people"],
"properties": {
"people": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["full_name"],
"properties": {
"full_name": { "type": "string", "minLength": 2 },
"email": { "type": ["string", "null"], "format": "email" },
"phone": { "type": ["string", "null"], "pattern": "^[+0-9 ()-]{7,20}$" },
"company": { "type": ["string", "null"] }
}
}
}
}
}
}
#pii#regex#entities

Intent + sentiment classification

Classification

Closed enums for label drift protection, with a required confidence band.

intent-classification.json
{
"name": "intent_classification",
"strict": true,
"schema": {
"type": "object",
"additionalProperties": false,
"required": ["intent", "sentiment", "confidence"],
"properties": {
"intent": {
"type": "string",
"enum": ["billing", "bug_report", "feature_request", "churn_risk", "other"]
},
"sentiment": { "type": "string", "enum": ["positive", "neutral", "negative"] },
"confidence": { "type": "number", "minimum": 0, "maximum": 1 },
"escalate": { "type": "boolean" }
}
}
}
#routing#enum#sentiment

Moderation gate

Structured Outputs

Boolean gate plus reason codes — safe to branch on without string parsing.

moderation-gate.json
{
"name": "moderation_gate",
"strict": true,
"schema": {
"type": "object",
"additionalProperties": false,
"required": ["allowed", "reason_codes"],
"properties": {
"allowed": { "type": "boolean" },
"reason_codes": {
"type": "array",
"items": {
"type": "string",
"enum": ["pii", "self_harm", "violence", "spam", "off_topic"]
}
},
"notes": { "type": "string", "maxLength": 300 }
}
}
}
#safety#boolean#codes