Expand description
Ollama HTTP-proxy backend for Blazen.
OllamaProvider forwards inference, embedding, and adapter
operations to a running Ollama server over its
native HTTP API. The endpoints exercised here, as of Ollama 0.3:
POST /api/generate— completion (NDJSON stream or single).POST /api/chat— chat completion (NDJSON stream or single).POST /api/embeddings— embed one or more inputs.GET /api/tags— list installed models.POST /api/show— model metadata (template, parameters, …).POST /api/pull— pull a model from the registry (NDJSON progress stream).POST /api/create— create a derived model from a Modelfile. Used here to mount aLoRAadapter via theADAPTERdirective.DELETE /api/delete— remove an installed model.
Unlike vLLM, Ollama does not expose a runtime adapter mount/unmount
pair. Adapters become full derived models via /api/create + a
Modelfile, which is the contract the upstream supports. See
OllamaProvider::load_adapter for the strategy.
This crate is intentionally a leaf — it does not depend on
blazen-llm. The trait-impl bridge lives in
crates/blazen-llm/src/backends/ollama.rs behind the ollama Cargo
feature on blazen-llm.
Structs§
- Mounted
Adapter - One adapter currently mounted on the upstream Ollama server, tracked
client-side so the bridge can answer
list_adapterswithout re-querying/api/tagsfor every call. - Ollama
Client - Reusable HTTP client wrapping
reqwest::Client. - Ollama
Model Entry - One row from
GET /api/tags. Ollama returns more fields (size, digest,modified_at, …) but the proxy only needs the name. - Ollama
Options - Options for constructing a
crate::OllamaProvider. - Ollama
Provider - Ollama proxy provider.
- Ollama
Pull Progress - One frame from an
/api/pullNDJSON stream. - Ollama
Show Response - Response from
POST /api/show. Only the fields the bridge actually reads are typed; Ollama may emit additional keys we forward asserde_json::ValueviaSelf::raw. - Ollama
Stream Part - One frame from a
/api/generateor/api/chatNDJSON stream.
Enums§
- Ollama
Adapter Transport - How a
crate::OllamaProviderhands adapters off to the upstream Ollama server. - Ollama
Error - Failures emitted by
crate::OllamaClientandcrate::OllamaProvider.