Arcanum.Adapters.Ollama (arcanum v0.1.10)

Copy Markdown View Source

Inference adapter for Ollama.

Handles wire protocol translation:

  • Request serialization (messages, tools, multimodal content via images field)
  • 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.

Functions

chat(provider, intent, profile)

Sends a synchronous chat completion request.

embed(provider, model, input)

Generates embeddings via /api/embed.

list_models(provider)

Lists available models via Ollama's tags endpoint.

stream(provider, intent, profile)

Sends a streaming chat completion request. Returns a Stream of {:data, response} and :done.