Validate and correct a result
Source:crates/rydantic-ai/examples/typed_agent.rs
model_calls=2 total_tokens=30; those token counts are demonstration data. The typed-agent tutorial explains the provider, schema and retry limits.
Stream partial objects and lists
Source:crates/rydantic-ai/examples/structured.rs
Pause and resume a graph
Source:crates/rydantic-ai/examples/graph.rs
output=42, steps=2.
Call an API with a typed tool
Source:crates/rydantic-ai/examples/provider.rs
Configure BASEURL, MODEL and optional APIKEY in your environment. Select the API protocol:
add tool and asks the model to compute 19 + 23. The final output is validated, and the program prints call and usage counters. Live output depends on the configured model and its tool capabilities. See API providers.
Describe an image
Source:crates/rydantic-ai/examples/vision.rs
With a configured image-capable model and a local image:
API=chat_completions and API=anthropic_messages use the other supported protocols. See image inputs for media types and limits.
Summarize a PDF
Source:crates/rydantic-ai/examples/pdf.rs
With a configured document-capable model and a local PDF:
Ask TypeSafe Jev typed questions
Source:crates/rydantic-ai/examples/jev.rs
Set both TYPESAFE_BASEURL and TYPESAFE_APIKEY locally, then run: