1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! *A Rust client library for Google's Gemini AI models.*
//!
//! # Overview
//!
//! This library provides a fully-featured client for interacting with Google's Gemini AI models,
//! supporting all major API features including:
//!
//! - Text generation and chat conversations
//! - JSON-structured outputs
//! - Function calling
//! - Safety settings and content filtering
//! - System instructions
//! - Model configuration (temperature, tokens, etc.)
//!
//! # Authentication
//!
//! The client requires a Gemini API key which can be provided in two ways:
//! - Environment variable: `GEMINI_API_KEY`
//! - Programmatically: `Client::new(api_key)`
//!
//! # Basic Usage
//!
//! ```rust,no_run
//! #[tokio::main]
//! async fn main() -> gemini_rs::Result<()> {
//! // Simple chat interaction
//! let response = gemini_rs::chat("gemini-2.0-flash")
//! .send_message("What is Rust's ownership model?")
//! .await?;
//! println!("{}", response);
//!
//! Ok(())
//! }
//! ```
//!
//! # Advanced Features
//!
//! The library supports advanced Gemini features through the `Client` and `Chat` types:
//!
//! - Model management (`client().models()`)
//! - Custom generation settings (`chat.config_mut()`)
//! - Safety settings (`chat.safety_settings()`)
//! - System instructions (`chat.system_instruction()`)
//! - Conversation history management (`chat.history_mut()`)
pub type Result<T> = Result;
pub use Chat;
pub use Client;
pub use Error;
pub use ;
/// Creates a new Gemini client instance using the default configuration.
/// Creates a new chat session with the specified Gemini model.