#gemini #google #ai

gemini-rs

A library to interact with the Google Gemini API

10 releases

0.4.2 Nov 15, 2024
0.4.1 Nov 14, 2024
0.3.2 Nov 5, 2024
0.2.3 Nov 3, 2024
0.1.0 Oct 30, 2024

#1255 in Web programming

Download history 301/week @ 2024-10-28 417/week @ 2024-11-04 324/week @ 2024-11-11 35/week @ 2024-11-18 2/week @ 2024-11-25 8/week @ 2024-12-09

61 downloads per month

MIT license

25KB
465 lines

STILL A WIP

A library to use Google Gemini's API directly in Rust! Made because the current options weren't very capable and didn't support 100% of the official API.

Example

// main.rs
use gemini_rs::Conversation;

#[tokio::main]
async fn main() {
    let mut convo = Conversation::new(
        std::env::var("GEMINI_API_KEY").unwrap(), // Replace with however you want to get your API key
        "gemini-1.5-flash".to_string() // Replace with the desired model from https://ai.google.dev/gemini-api/docs/models/gemini
    );

    let a = convo.prompt("If you had to describe Risk of Rain 2 in one word, what word would it be?").await;
    println!("{a}");
    let b = convo.prompt("Now explain your reasoning").await;
    println!("{b}");
}

Roadmap

  • Error handling
  • Conversation history
  • Useless refactor for no good reason (cry for help) (x2)
  • Make more operations for conversations (saving, loading, etc.)
  • Image support
  • Better documentation
  • 100% API coverage

Dependencies

~6–17MB
~227K SLoC