Concepts

Schemas

Schemas define the expected output contract from the LLM. They are the foundation of Reliant — without a schema, there is no validation.


What is a Schema?

A schema is a JSON Schema (draft-7) that describes exactly the format the LLM should return. Reliant uses this schema to validate each output and rewrite the prompt when needed.

json — exemplo de schema
{ "type": "object", "required": ["name", "email"], "properties": { "name": { "type": "string", "description": "Full name of the person" }, "email": { "type": "string", "format": "email" }, "phone": { "type": "string" }, "age": { "type": "number", "minimum": 0, "maximum": 150 } } }

Creating a Schema

You can create schemas via the Dashboard or via the API/SDK.

Via Dashboard

Go to Dashboard → Schemas → click + New Schema and fill out the form.

Via SDK

typescript
const schema = await reliant.createSchema({ name: 'Sentiment Analysis', slug: 'sentiment-analysis', description: 'Analyzes the sentiment of a text', definition: { type: 'object', required: ['sentiment', 'confidence'], properties: { sentiment: { type: 'string', enum: ['positive', 'negative', 'neutral'] }, confidence: { type: 'number', minimum: 0, maximum: 1 }, summary: { type: 'string' } } }, safe_fallback: { sentiment: 'neutral', confidence: 0, summary: null } })

Versioning

Each schema update automatically creates a new version. Previous executions remain linked to the schema version that was active at the time — ensuring complete traceability.

FieldTypeDescription
namestringHuman-readable schema name
slugstringUnique identifier, lowercase with hyphens
definitionobjectJSON Schema draft-7 that defines the contract
safe_fallbackobjectReturned when all retries fail
versionnumberAutomatically incremented on each update