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
16
17
18
use rust_genai::types::operations::Operation;
use rust_genai::Client;

#[tokio::main]
async fn main() -> rust_genai::Result<()> {
    let client = Client::from_env()?;
    let Ok(op_name) = std::env::var("GENAI_OPERATION_NAME") else {
        println!("set GENAI_OPERATION_NAME to wait for an operation.");
        return Ok(());
    };
    let op = Operation {
        name: Some(op_name),
        ..Default::default()
    };
    let op = client.operations().wait(op).await?;
    println!("done: {done:?}", done = op.done);
    Ok(())
}