Structured Output
Get validated, typed responses from any model. Define your schema, and Veska ensures every response matches — with automatic retry when validation fails.
Live Demo
See the difference
Raw text vs validated, structured output — watch validation happen in real-time, including automatic retry on type errors.
How It Works
Three steps to type safety
Define Your Schema
Use Pydantic models to describe the exact shape you want. Fields, types, constraints — all defined in Python.
Agent Generates
The agent sends your prompt to the model. The response is parsed and mapped against your schema automatically.
Validate & Retry
Pydantic validates every field. If anything fails, Veska automatically retries with the error feedback until it passes.
Benefits
Why structured output matters
Type Safety
Every response matches your schema. No more parsing JSON strings or hoping the model follows instructions.
Auto-Retry
When validation fails, Veska sends the error back to the model and retries automatically. No manual error handling needed.
Any Model
Works with every provider Veska supports. Same schema, same validation, regardless of which model powers your agent.
Nested Schemas
Support for complex objects, lists, enums, optional fields, and deeply nested structures out of the box.
Architecture
Validation flow
Every response passes through automatic validation. Failed fields trigger a retry loop with error context.
Never parse raw text again
Define your schema, let Veska handle validation and retries.