Initial Commit

This commit is contained in:
2025-11-26 17:51:15 +00:00
commit 6786a5e9f0
16 changed files with 1832 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
use std::{env, error::Error};
use google_genai::prelude::{Content, GeminiClient, GenerateContentRequest, Role};
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
tracing_subscriber::fmt().init();
let _ = dotenvy::dotenv();
let api_key = env::var("GEMINI_API_KEY")?;
let gemini_client = GeminiClient::new(api_key);
let prompt = vec![
Content::builder()
.role(Role::User)
.add_text_part("What is the airspeed of an unladen swallow?")
.build(),
];
let request = GenerateContentRequest::builder().contents(prompt).build();
let response = gemini_client
.generate_content(&request, "gemini-3-pro-preview")
.await?;
println!("Response: {:?}", response.candidates[0].get_text().unwrap());
Ok(())
}