gemini_light_rs

Crates.iogemini_light_rs
lib.rsgemini_light_rs
version0.1.1
created_at2025-07-10 15:39:02.271705+00
updated_at2025-09-02 21:37:45.012693+00
descriptionA Rust client for interacting with Google's Gemini API.
homepage
repositoryhttps://github.com/Priyansh6747/Gemini_rs
max_upload_size
id1746659
size58,745
Priyansh Singh Tanwar (Priyansh6747)

documentation

README

gemini_light_rs

A Rust client for interacting with Google's Gemini generative language models. Supports conversation memory, stateless calls, and easy integration.

Features

  • Async chat with Gemini models
  • Conversation memory (contextual chat)
  • Simple, ergonomic API

Installation

Add to your Cargo.toml:

[dependencies]
gemini_light_rs = "0.1.0"

API Key Setup

You need a Google Gemini API key pass the key and model as arguments to Client::new.

Example Usage

use gemini_light_rs::Client;

#[tokio::main]
async fn main() {
    let mut c = Client::new("your_api_key", "gemini-2.5-flash");
    let res = c.chat("Hello my name is Max").await;
    if let Err(e) = res {
        panic!("{}", e);
    }
    let res2 = c.chat("Whats my name answer in single word only (answer containing more than 1 word will be treated as incorrect)").await;
    let name = res2.unwrap_or_else(|_| "Error".to_string());
    println!("Gemini answered: {}", name);
    assert_eq!(&name, "Max");
}

API Overview

  • Client::new(api_key, model) – create a new client

  • client.chat(input) – send a message, get a response (with memory)

  • client.chat_once(input) – stateless single message

  • client.clear_memory() – clear conversation history


Commit count: 11

cargo fmt