rust-genai 0.3.1

Rust SDK for the Google Gemini API and Vertex AI
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use rust_genai::types::interactions::{CreateInteractionConfig, InteractionInput};
use rust_genai::Client;

#[tokio::main]
async fn main() -> rust_genai::Result<()> {
    let client = Client::from_env()?;
    let interactions = client.interactions();

    let input = InteractionInput::text("用一句话介绍 Rust 的优势。");
    let config = CreateInteractionConfig::new("gemini-3-flash-preview", input);
    let interaction = interactions.create(config).await?;

    println!("{:#?}", interaction.outputs);
    Ok(())
}