#gemini #api #interact #bridge #ai-api

gemini_bridge

Types and functions to interact with Gemini AI API

10 releases

new 0.1.9 Nov 7, 2024
0.1.8 Nov 7, 2024

#666 in Web programming

Download history 751/week @ 2024-10-31

751 downloads per month

MIT/Apache

9KB
185 lines

Gemini Bridge

Gemini Bridge is a Rust crate designed to interact with the Gemini API. This crate aims to provide a seamless and efficient way to communicate with Gemini API.

Features

  • Easy-to-use interface for interacting with the Gemini API
  • Asynchronous support for non-blocking operations
  • Comprehensive error handling

Installation

Add gemini_bridge to your Cargo.toml:

[dependencies]
gemini_bridge = "0.1.4"
# example version

Usage

extern crate gemini_rs;

async fn main() {
    let gen = GeminiRs::new_text_generator("api_key_xxxxxxx", "gemini-1.5-flash-latest".to_owned());
    let res = gen
        .generate_content(RequestBody {
            contents: vec![Content {
                parts: vec![Part {
                    text: "send me a test response".to_owned(),
                }],
            }],
            safety_settings: None,
            generation_config: None,
        })
        .await;
}

Not tested yet with other models.

TODO

  • Implement Content Generation Method
  • Implement Conversation
  • Implement Embeddings
  • Add examples and documentation
  • Write tests

Dependencies

~7–18MB
~238K SLoC