Expand description
Rust client for Google’s Generative AI APIs
Provides a type-safe, ergonomic interface for interacting with Google’s AI services including Gemini. Features comprehensive API coverage with compile-time schema validation and async/await support.
§Highlights
- Type-Safe API Interactions: Generated from official Google discovery documents
- Multi-modal Support: Text, images, and structured data in single requests
- Production-Ready: Connection pooling, retries, and comprehensive error handling
§Quickstart
use google_ai_rs::{Client, GenerativeModel};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new("API_KEY".into()).await?;
let model = client.generative_model("gemini-pro");
let response = model.generate_content(
"Explain quantum physics using pirate metaphors"
).await?;
println!("{}", response.text());
Ok(())
}
Re-exports§
pub use auth::Auth;
pub use client::Client;
pub use error::Error;
pub use genai::GenerativeModel;
pub use crate::proto::Schema;
pub use crate::schema::AsSchema;
pub use crate::schema::SchemaType;
pub use proto::CachedContent;
pub use proto::Candidate;
pub use proto::Content;
pub use proto::FunctionCall;
pub use proto::GenerationConfig;
pub use proto::Part;
pub use proto::TaskType;
pub use proto::Tool;
Modules§
Derive Macros§
- AsSchema
- Warning: No Recursive Types!