🌟 Google AI in Rust: Delightfully Safe & Expressive
Meet your new favorite way to interact with Google's Generative AI -
Type-safe, fluent, and crafted for Rustaceans who love joy in their code!
[]
= "0.1.0"
Why You'll ❤️ This Library
1. Type Safety That Sings 🎶
Turn API schemas into Rust structs with derive macros:
// Automatically validates against Google's schema!
let model = model.;
let response = model.generate_content.await?;
let colors = ?;
println!; // Guaranteed to exist!
2. Input Flexibility That Feels Like Magic 🔮
Pass content in any shape - we'll handle the rest:
// Single text
model.generate_content.await?;
// Mixed media tuple
model.generate_content.await?;
3. Full API Coverage Without the Headaches 📚
We handle the boilerplate so you can focus on AI:
// Chat with context
let mut chat = model.start_chat;
chat.send_message.await?;
// Batch embeddings
let batch = client.batch
.add_content
.add_content;
let embeddings = batch.embed.await?;
// Model management
let tuned_model = client.get_tuned_model.await?;
Key Features That Make a Difference
✨ Schema-first Design
- Derive macros that match Google's schemas exactly
- Serde integration out of the box
- Automatic description propagation to API
🧩 Content Composition Power
IntoParts
trait handles any input combination- Tuples, vectors, slices - we speak them all
- Media handling that feels native
🛡️ Production-Ready Safety
match model.generate_content.await
🔑 Auth That Adapts to You
// API Key simplicity
new.await?;
// Service account power
builder
.concurrency_limit
.build
.await?;
Get Started in 60 Seconds
- Add the crate:
[]
= { = "0.1.0" }
- Basic usage:
use ;
async
Performance Meets Ergonomics 🚀
While we prioritize developer happiness, we didn't compromise on power:
- gRPC Core: 2-3x faster than REST wrappers
- Connection Pooling: Built-in with tonic/hyper
"Finally, a Google AI client that feels like Rust should!"
– Happy User (probably you, after trying it 😉)