Thin layer on ollama-rs: configured reqwest, optional call / call_stream (timeouts, concurrency, retries), and ensure for “is this model local?” (lists; may pull only when auto_pull + Development). Does not start Ollama.
ollama-kit = "0.2"
ollama-kit = { version = "0.2", features = ["stream"] }OllamaRuntime::new + RuntimeConfig |
URL, timeouts, auth; rejects Production + auto_pull. |
ensure |
List local names; pull only if auto_pull and Development. |
auto_pull / mode |
Getters mirroring [RuntimeConfig]. |
call / call_stream |
Guarded ollama-rs calls. |
client / guard |
Unguarded; use guard().run for Fn() shapes. |
use std::time::Duration;
use ollama_kit::{OllamaRuntime, RuntimeConfig, RuntimeMode};
async fn demo() -> ollama_kit::Result<()> {
let rt = OllamaRuntime::new(RuntimeConfig {
base_url: "http://127.0.0.1:11434".into(),
timeout: Duration::from_secs(120),
connect_timeout: Duration::from_secs(10),
max_retries: 2,
max_concurrent: 4,
auto_pull: false,
mode: RuntimeMode::Production,
auth: None,
})
.await?;
rt.ensure("mistral").await?;
let _ = rt.call(|c| c.list_local_models()).await?;
Ok(())
}cargo doc. MIT — LICENSE.