Skip to content

Pulko/ollama-kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ollama-kit

Crates.io Documentation License Crates.io downloads CI

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.

Cargo.toml

ollama-kit = "0.2"
ollama-kit = { version = "0.2", features = ["stream"] }

API sketch

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.

Example

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(())
}

Docs / license

cargo doc. MIT — LICENSE.

About

Kit for using Ollama client with safety

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages