Expand description
Ollama provider for chat-rs.
Thin wrapper around chat_completions — Ollama serves an
OpenAI-compatible /v1/chat/completions endpoint, so all chat,
streaming, tools, structured output, and embedding logic lives in the
chat-completions crate.
What this crate adds on top:
- Default base URL pointing at the local daemon
OLLAMA_HOSTenv var supportOllamaBuilder::pullto ensure the model is present before the first request, hitting Ollama’s native/api/pull. Returns the builder so it slots into the normal chain.
use chat_ollama::OllamaBuilder;
let client = OllamaBuilder::new()
.with_model("llama3.2")
.pull().await?
.build();Structs§
- Ollama
Builder - Ollama-flavored builder. Wraps
CompletionsBuilderand adds/api/pullintegration so a model can be fetched at build time. - With
Model - Without
Model
Constants§
- DEFAULT_
OLLAMA_ HOST - Default Ollama base host when
OLLAMA_HOSTis not set.