| Crates.io | ragzilla-embedding |
| lib.rs | ragzilla-embedding |
| version | 0.2.0 |
| created_at | 2025-03-21 20:39:23.003741+00 |
| updated_at | 2025-03-22 15:59:20.275585+00 |
| description | A Rust library for creating text embeddings using the Gemini API |
| homepage | |
| repository | https://github.com/excoffierleonard/ragzilla |
| max_upload_size | |
| id | 1601137 |
| size | 43,485 |
A Rust library for creating text embeddings using the Gemini API.
Add the following to your Cargo.toml file:
[dependencies]
ragzilla-embedding = "0.1.0"
use ragzilla_embedding::create_embedding;
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let api_key = std::env::var("GEMINI_API_KEY").expect("GEMINI_API_KEY must be set");
let text = "What is the meaning of life?";
let embedding = create_embedding(text, &api_key).await?;
println!("Generated embedding with {} dimensions", embedding.len());
Ok(())
}
create_embeddingpub async fn create_embedding(text: &str, api_key: &str) -> Result<Vec<f32>, reqwest::Error>
Generates an embedding vector for the provided text using the Gemini API.
text: The text to create an embedding forapi_key: Your Gemini API keyReturns a Result containing a vector of floating-point values representing the embedding.
MIT License