chat-gemini
Google Gemini provider for chat-rs.
Install
[]
= "0.4.0"
= "0.2.4"
= { = "1", = ["macros", "rt-multi-thread"] }
Or via the umbrella crate: chat-rs = { version = "0.5.0", features = ["gemini"] }.
Usage
use GeminiBuilder;
use ;
let client = new
.with_model
.build;
let mut chat = new.with_model.build;
let mut msgs = from_user;
let response = chat.complete.await?;
Set GEMINI_API_KEY in your environment or call .with_api_key() on the builder.
Capabilities
- Completions — text generation with tool calling and structured output
- Streaming — token-by-token output (requires
streamfeature) - Embeddings — vector embeddings via
.with_embeddings(dimensions) - Extended thinking — enable with
.with_thoughts(true)
Custom Transport
Supply a custom transport via .with_transport() to use something other than the default HTTP (reqwest):
let client = new
.with_model
.with_transport
.build;
Native Tools
- Google Search —
.with_google_search()or.with_google_search_threshold(f32) - Code Execution —
.with_code_execution() - Google Maps —
.with_google_maps(lat_lng, widget)
Feature Flags
Streaming is gated on the stream feature:
= { = "0.2.3", = ["stream"] }