Skip to content

Latest commit

Β 

History

History
59 lines (43 loc) Β· 1.36 KB

File metadata and controls

59 lines (43 loc) Β· 1.36 KB

gemini-rust

A comprehensive Rust client for Google's Gemini API with full feature support.

Features

  • πŸ—οΈ Structured Output - Type-safe JSON schema generation
  • 🧠 Thinking Mode - Gemini 2.5's reasoning capabilities
  • πŸ”§ Function Calling - Parallel and compositional functions
  • πŸ” Grounding - Google Search and URL context
  • πŸ’Ύ Context Caching - Efficient token management
  • 🌊 Streaming - Real-time response streaming
  • πŸ”„ Automatic Retries - With exponential backoff
  • πŸ¦€ 100% Rust - Type-safe and memory-safe

Installation

Add to your Cargo.toml:

[dependencies]
gemini-rust = "0.1"

Or with specific features:

[dependencies]
gemini-rust = { version = "0.1", features = ["grounding", "caching"] }

Quick Start

use gemini_rust::prelude::*;

#[tokio::main]
async fn main() -> Result<()> {
    // Create client from GEMINI_API_KEY environment variable
    let client = GeminiClient::from_env()?;
    
    // Generate content
    let response = client
        .generate_content(None, GenerateContentRequest {
            contents: vec![Content::user("Hello, Gemini!")],
            ..Default::default()
        })
        .await?;
    
    println!("{:?}", response);
    Ok(())
}

License

Licensed under either of: