⚠️ WARNING: This is a pre-release version with an unstable API. Breaking changes may occur between versions. Use with caution and pin to specific versions in production applications.
Quick Start
use ;
let analysis = with
.api_key?
.model
.messages
.
.await?;
Structured Generation
Get AI responses that conform to your exact Rust types - no JSON parsing required!
The #[completion_schema] macro automatically adds the necessary derives and attributes for structured output:
#[derive(serde::Deserialize, schemars::JsonSchema)]#[schemars(deny_unknown_fields)]
Structs
let review = with
.api_key?
.model
.messages
.
.await?;
Simple Enums
let priority = with
.api_key?
.model
.messages
.
.await?;
Enums with Data
let status = with
.api_key?
.model
.messages
.
.await?;
Manual Schema Definition (Alternative)
If you prefer manual control, you can still use the traditional approach:
use Deserialize;
use JsonSchema;
Note: The library automatically handles provider-specific requirements. For example, OpenAI requires root schemas to be objects, so non-object types like enums are transparently wrapped and unwrapped.
Known Issues
- ..
License
This project is licensed under the MIT License - see the LICENSE file for details.