Skip to main content

gemini_chat_api/
lib.rs

1//! Async Rust client for Google Gemini Chat API.
2//!
3//! This library provides an async HTTP client for interacting with Google Gemini,
4//! similar to the Python `gemini_client` library.
5//!
6//! # Example
7//! ```no_run
8//! use gemini_chat_api::{AsyncChatbot, Model, load_cookies};
9//!
10//! #[tokio::main]
11//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
12//!     // Load cookies from file
13//!     let (psid, psidts) = load_cookies("cookies.json")?;
14//!
15//!     // Create chatbot
16//!     let mut chatbot = AsyncChatbot::new(&psid, &psidts, Model::default(), None, 30).await?;
17//!
18//!     // Send message
19//!     let response = chatbot.ask("Hello! Tell me a joke.", None).await?;
20//!     println!("{}", response.content);
21//!
22//!     Ok(())
23//! }
24//! ```
25
26pub mod client;
27pub mod enums;
28pub mod error;
29pub mod utils;
30
31// Re-exports for convenience
32pub use client::{AsyncChatbot, ChatResponse, Choice, SavedConversation};
33pub use enums::{Endpoint, Model};
34pub use error::{Error, Result};
35pub use utils::load_cookies;