| Crates.io | adk-gemini |
| lib.rs | adk-gemini |
| version | 0.2.1 |
| created_at | 2025-12-29 04:05:45.11526+00 |
| updated_at | 2026-01-22 03:35:01.792845+00 |
| description | Rust client for Google Gemini API |
| homepage | |
| repository | https://github.com/zavora-ai/adk-rust |
| max_upload_size | |
| id | 2009914 |
| size | 2,127,204 |
ADK-Rust fork of the gemini-rust library
A comprehensive Rust client library for Google's Gemini 2.5 API, maintained as part of the ADK-Rust project.
This crate is a fork of the excellent gemini-rust library by @flachesis. We are deeply grateful for their work in creating and maintaining this high-quality Gemini API client.
We are committed to:
The ADK-Rust project requires certain extensions for deep integration with the Agent Development Kit:
GroundingMetadata, GroundingChunk) for grounding supportWe will regularly sync with upstream to incorporate improvements and fixes.
serde supporttokio for high-performance async operationsGroundingMetadata for Google Search resultsThis crate is part of the ADK-Rust workspace. Add it to your Cargo.toml:
[dependencies]
adk-gemini = "0.2.0"
Or use it through adk-model:
[dependencies]
adk-model = { version = "0.2.1", features = ["gemini"] }
use adk_gemini::Gemini;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let api_key = std::env::var("GOOGLE_API_KEY")?;
let client = Gemini::new(api_key)?;
let response = client
.generate_content()
.with_user_message("Hello, Gemini!")
.execute()
.await?;
println!("{}", response.text());
Ok(())
}
Access Google Search grounding results:
use adk_gemini::{Gemini, GroundingMetadata, GroundingChunk, WebGroundingChunk};
// Access grounding metadata from responses
if let Some(grounding) = response.candidates.first()
.and_then(|c| c.grounding_metadata.as_ref())
{
if let Some(queries) = &grounding.web_search_queries {
println!("Searched: {:?}", queries);
}
if let Some(chunks) = &grounding.grounding_chunks {
for chunk in chunks {
if let Some(web) = &chunk.web {
println!("Source: {} - {}", web.title, web.uri);
}
}
}
}
See the examples/ directory for comprehensive usage examples covering:
This project is licensed under the MIT License - see the LICENSE file for details.
Original work Copyright (c) 2024 @flachesis
Modifications Copyright (c) 2024 Zavora AI