Class OllamaCodec

java.lang.Object
org.mockserver.llm.codec.OllamaCodec
All Implemented Interfaces:
ProviderCodec

public class OllamaCodec extends Object implements ProviderCodec
Codec for Ollama /api/chat endpoint (version ollama-2025).

Ollama uses a distinct JSON shape with a top-level message object (not an array of choices). Token counts are exposed as prompt_eval_count and eval_count.

Streaming format: Ollama's native wire format is NDJSON (newline-delimited JSON, application/x-ndjson), not SSE. Each streaming chunk is a single JSON object followed by a newline character (<json>\n). This codec internally represents chunks as SseEvent objects (reusing the existing data/delay model), but declares StreamingFormat.NDJSON via streamingFormat() so that the downstream write handler emits raw NDJSON framing instead of SSE data: prefixes.

Tool calls use Ollama 0.3+ format where arguments is a JSON object (not a JSON-as-string like OpenAI).