1use gemini_client_api::gemini::ask::Gemini;
2use gemini_client_api::gemini::types::sessions::Session;
3use std::env;
4
5#[tokio::main]
6async fn main() {
7 let mut session = Session::new(6);
9
10 let api_key = env::var("GEMINI_API_KEY").expect("GEMINI_API_KEY must be set");
13 let ai = Gemini::new(
14 api_key,
15 "gemini-2.5-flash",
16 Some("You are a senior engineer at google".into()),
17 );
18
19 let prompt = "What are the benefits of using Rust for systems programming?";
21 session.ask(prompt);
22 session.ask("\nKeep you answer short");
23
24 println!("User: {:?}", session.get_last_chat().unwrap().parts());
25 let response = ai.ask(&mut session).await.unwrap();
26
27 let reply = response.get_chat().get_text_no_think("");
30 println!("\nGemini: {}", reply);
31
32 println!("\nMessages in history: {}", session.get_history_length());
34}