test_api/
test_api.rs

1use gemini_rust::Gemini;
2use std::env;
3
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    let api_key = env::var("GEMINI_API_KEY")?;
7
8    // Create client with the default model (gemini-2.0-flash)
9    let client = Gemini::new(api_key);
10
11    println!("Sending request to Gemini API...");
12
13    // Simple text completion with minimal content
14    let response = client
15        .generate_content()
16        .with_user_message("Say hello")
17        .execute()
18        .await?;
19
20    println!("Response: {}", response.text());
21
22    Ok(())
23}