Crates.io | kazama |
lib.rs | kazama |
version | 0.1.3 |
source | src |
created_at | 2024-07-10 06:18:25.803076 |
updated_at | 2024-07-13 13:55:58.31302 |
description | an ollama wrapper in rust |
homepage | |
repository | https://github.com/spirizeon/kazama |
max_upload_size | |
id | 1297888 |
size | 9,926 |
🤖 Rust client library for interacting with the Ollama API, enabling operations like chat completions, model pulls, embeddings generation, model listing, and model pushes.
chat_completion(model, content, role)
pull_model(name, stream_mode)
gen_embeddings(model, prompt)
list_models()
push_models(name, stream_mode)
use kazama::{chat_completion, pull_model, gen_embeddings, list_models, push_models};
#[tokio::main]
async fn main() {
// Example: Chat Completion
chat_completion("model_name", "Hello!", "user").await.expect("Failed to complete chat");
// Example: Model Pull
pull_model("model_name", false).await.expect("Failed to pull model");
// Example: Generate Embeddings
gen_embeddings("model_name", "Generate embeddings from this prompt").await.expect("Failed to generate embeddings");
// Example: List Models
list_models().await.expect("Failed to list models");
// Example: Push Models
push_models("model_name", true).await.expect("Failed to push model");
}
For detailed API documentation, refer here. Acknowledgement for icon: https://www.artstation.com/artwork/n0q6Ye