Skip to content

alphastrata/jemini

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Banner  1 Banner  2 Banner  3
art by Gemini

Jemini

Jemini is a Rust library that provides a simple and intuitive interface for interacting with the Google Gemini REST API.

It exists because I couldn't help but notice that there's no Rust option in their docs... shame on you Google.

And, there are the results for the mandatory crates.io search.

Note: This API's subject and models from the phind:codellama family are co-authors.

It is by no means exhaustive, and is most definitely a WIP, however the included examples should show you how useful/not-useful it would be to your use case.

Goals:

  • Easy-to-use API client for Google Gemini services.
  • Convenient methods for generating content using the Gemini API.

Usage

To get started with Jemini, add it as a dependency to your Rust project's Cargo.toml file:

[dependencies]
jemini = "0.1.0"

After adding Jemini as a dependency, you will need to obtain an API key from the Google Gemini API to interact with the services.

NOTE: A Google AI Studio account is required (Currently free).

Make sure to set the GEMINI_API_KEY environment variable with your API key before running your application.

Then, in your main.rs:

use jemini::{JeminiClient, GeminiError};

#[tokio::main]
async fn main() -> Result<(), GeminiError> {
    let client = JeminiClient::new()?;
    let response: GeminiResponse = client.text_only("What is the meaning of life?").await?;

    dbg!(&response);
    println!("{}", response.most_recent().unwrap());

    Ok(())

}

NOTE: GeminiError will #transparent most of / all of the errors possible from the dependency crates so be aware of that should you encounter problems.

Testing

To run the tests for Jemini, use the following command:

cargo test

Contributing

Contributions to Jemini are welcome! Please feel free to open an issue or submit a pull request if you have improvements or bug fixes.

License

Jemini is licensed under the MIT License.

Resources like this:

https://crates.io/crates/google-generative-ai-rs by https://crates.io/users/avastmick

About

a Rusty wrapper around the Google Gemini REST API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages