Gemini Client Library
A powerful, flexible, and feature-rich Rust library for Google's Gemini API, featuring procedural macros for "super powers" like automatic JSON schema generation and function calling.
✨ Features
- Automatic Context Management: Simple
Sessionstruct to handle conversation history. - Procedural Macros:
#[gemini_schema]: Generate JSON schemas directly from your Rust structs and enums.#[gemini_function]: Turn Rust functions into Gemini-callable tools with minimal boilerplate.execute_function_calls!: Seamlessly dispatch and handle multiple function calls requested by Gemini.
- Multimodal Support: Built-in markdown parser for images and local files.
- Advanced Capabilities: Code execution, PDF/document/audio reading, and "Thinking" mode support.
- Framework Agnostic: Modular design that works anywhere, including Actix, Axum, and WASM environments.
Basic Chat Example
use Gemini;
use Session;
async
📖 Deep Dive
Explore our comprehensive examples to learn how to use advanced features:
- Basic Chat: Simple request-response interaction.
- Streaming: Handling real-time chunks for a snappier UI experience.
- Structured Output: Forcing Gemini to reply in a specific JSON format using
#[gemini_schema]. - Function Calling: Giving Gemini tools to interact with the real world using
#[gemini_function]. - Thinking Mode: Enabling Gemini's reasoning capabilities.
- Multimodal: Sending images and files to Gemini.
For WASM environments, disable default features:
[]
= { = "...", = false }