engine: add the ollama System One provider

A third decision-engine provider alongside the local SemIf GGUF and the
remote Winnow server: `engine.provider == "ollama"` talks to ollama's
native `/v1/systemone` route via `semif_agent/ollama_systemone.py`.

It reuses the Winnow DecisionRequest -> choice mapping and the same strict
distribution validation over exactly the requested option ids, and adds
the edges only ollama has:

- no `/health`: `warm()` probes `GET /api/version` + `POST /api/show`,
  which also proves the model is pulled and advertises the `decision`
  capability;
- `engine.ollama.context_tokens: 0` follows the model's real `num_ctx`
  from `/api/show`;
- `keep_alive` rides on the request, criteria descriptions use the ollama
  subset `string | null`, and a choice question needs >= 2 options;
- decision models do not generate text, so `generate()` raises
  `EngineUnavailable` (use `llm.provider == "ollama"` for chat).

Every failure is an `EngineUnavailable` (fatal, like the local engine) and
the engine lock still serializes on the single-slot server.

`cli.build_engine` selects it, the setup interview and `--answers` accept
it, and the install plan skips the engine clone/GGUF/tokenizer for it.
Docs, config.example.json, and tests updated.
This commit is contained in:
gabby committed 2026-11-11 02:57:53 +00:00
1 parent 894a85ec2d
commit addbe53392
12 files changed
+903 -41

No files matched your search

+7 -5
View File
@@ -8,10 +8,12 @@ question type: the options become the question's ``criteria`` (id -> description
and the question becomes its ``instructions``; the server returns a probability
over exactly those keys.
Winnow runs as its own process (``winnow-server``); see ``local/ENVIRONMENT.md``
for this deployment. The engine is real: any network, HTTP, or distribution
failure raises `EngineUnavailable`, which the scheduler treats as fatal — there
is no fallback model and no fabricated reply.
It works against any server implementing that route: the reference
``winnow-server``, or an OpenAI-compatible host (ollama 0.40+) serving a
``decision`` model such as ``clef-flash``. See ``local/ENVIRONMENT.md`` for this
deployment. The engine is real: any network, HTTP, or distribution failure
raises `EngineUnavailable`, which the scheduler treats as fatal — there is no
fallback model and no fabricated reply.
"""
from __future__ import annotations
@@ -24,7 +26,7 @@ import urllib.error
import urllib.request
from dataclasses import dataclass
from .decisions import DecisionRequest, DecisionResult
from .decisions import DecisionRequest, DecisionResult, Option
from .engine import DecisionEngine, EngineUnavailable