adk-gemini
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.
🙏 Attribution
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.
Upstream Project
- Repository: github.com/flachesis/gemini-rust
- Crates.io: crates.io/crates/gemini-rust
- Original Author: @flachesis
Our Commitment
We are committed to:
- Staying aligned with the upstream gemini-rust project as much as possible
- Contributing back any general improvements that would benefit the broader community
- Maintaining attribution and respecting the original MIT license
- Minimizing divergence - only adding ADK-specific extensions when necessary
Why a Fork?
The ADK-Rust project requires certain extensions for deep integration with the Agent Development Kit:
- Exporting additional types (e.g.,
GroundingMetadata,GroundingChunk) for grounding support - Future ADK-specific extensions for agent workflows
- Workspace-level version management
We will regularly sync with upstream to incorporate improvements and fixes.
✨ Features
- 🚀 Complete Gemini 2.5 API Implementation - Full support for all Gemini API endpoints
- 🛠️ Function Calling & Tools - Custom functions and Google Search integration with OpenAPI schema support
- 📦 Batch Processing - Efficient batch content generation and embedding
- 💾 Content Caching - Cache system instructions and conversation history for cost optimization
- 🔄 Streaming Responses - Real-time streaming of generated content
- 🧠 Thinking Mode - Support for Gemini 2.5 thinking capabilities
- 🎨 Image Generation - Text-to-image generation and image editing capabilities
- 🎤 Speech Generation - Text-to-speech with single and multi-speaker support
- 🖼️ Multimodal Support - Images and binary data processing
- 📊 Text Embeddings - Advanced embedding generation with multiple task types
- ⚙️ Highly Configurable - Custom models, endpoints, and generation parameters
- 🔒 Type Safe - Comprehensive type definitions with full
serdesupport - ⚡ Async/Await - Built on
tokiofor high-performance async operations - 🌐 Grounding Support - Full access to
GroundingMetadatafor Google Search results
📦 Installation
This crate is part of the ADK-Rust workspace. Add it to your Cargo.toml:
[]
= "0.1.7"
Or use it through adk-model:
[]
= { = "0.1.7", = ["gemini"] }
🚀 Quick Start
use Gemini;
async
🔧 ADK-Specific Extensions
Grounding Metadata
Access Google Search grounding results:
use ;
// Access grounding metadata from responses
if let Some = response.candidates.first
.and_then
📚 Examples
See the examples/ directory for comprehensive usage examples covering:
- Basic content generation
- Streaming responses
- Function calling & tools
- Google Search grounding
- Thinking mode (Gemini 2.5)
- Image and speech generation
- Batch processing
- Content caching
📄 License
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
🙏 Acknowledgments
- @flachesis - Creator and maintainer of the original gemini-rust library
- @npatsakula - Major contributions to the upstream project
- Google for providing the Gemini API
- The Rust community for excellent async and HTTP libraries
- All contributors to both gemini-rust and adk-rust projects