Skip to main content

Crate laminae_ollama

Crate laminae_ollama 

Source
Expand description

§laminae-ollama — Ollama Client for Local LLM Inference

Standalone HTTP client for Ollama. Supports both blocking and streaming completions via the /api/chat endpoint.

Zero internal dependencies — this crate talks to a local Ollama instance and nothing else.

§Quick Start

use laminae_ollama::OllamaClient;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let client = OllamaClient::new();

    if !client.is_available().await {
        eprintln!("Ollama is not running — start it with `ollama serve`");
        return Ok(());
    }

    let response = client.complete(
        "llama3.2",
        "You are a helpful assistant.",
        "What is 2 + 2?",
        0.7,
        256,
    ).await?;

    println!("{response}");
    Ok(())
}

Structs§

OllamaClient
Client for Ollama’s local LLM API.
OllamaConfig
Configuration for creating an OllamaClient.

Enums§

OllamaError
Typed errors for the Ollama client.