Inference adapter for Ollama.
Handles wire protocol translation:
- Request serialization (messages, tools, multimodal content via
imagesfield) - System role demotion at serialization time (profile-driven)
- Response parsing (faithful field mapping)
- Embeddings via
/api/embed - Retry on transient HTTP errors (429, 502, 503)
Ollama multimodal works differently from OpenAI/Anthropic: images are passed
as a separate images field (list of base64 strings) on the message, alongside
the text content field. This adapter handles that split automatically from
canonical content blocks.
Summary
Functions
Sends a synchronous chat completion request.
Generates embeddings via /api/embed.
Lists available models via Ollama's tags endpoint.
Sends a streaming chat completion request. Returns a Stream of {:data, response} and :done.