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:
1 parent
894a85ec2d
commit
addbe53392
12 files changed
+903
-41
No files matched your search
@@ -19,6 +19,7 @@ from semif_agent.engine import (
|
||||
_install_gpu_state_reset,
|
||||
_offloading_params,
|
||||
)
|
||||
from semif_agent.ollama_systemone import OllamaSystemOneEngine
|
||||
from semif_agent.winnow import WinnowEngine
|
||||
|
||||
PINS = {
|
||||
@@ -111,3 +112,32 @@ def test_build_engine_selects_the_winnow_provider():
|
||||
def test_build_engine_winnow_requires_a_model():
|
||||
with pytest.raises(SystemExit):
|
||||
build_engine({"engine": {"provider": "winnow", "winnow": {}}}, PINS)
|
||||
|
||||
|
||||
def test_build_engine_selects_the_ollama_systemone_provider():
|
||||
engine = build_engine(
|
||||
{
|
||||
"engine": {
|
||||
"provider": "ollama",
|
||||
"ollama": {
|
||||
"base_url": "http://example:11434",
|
||||
"model": "clef-flash",
|
||||
"context_tokens": 8192,
|
||||
"keep_alive": "5m",
|
||||
},
|
||||
}
|
||||
},
|
||||
PINS,
|
||||
)
|
||||
assert isinstance(engine, OllamaSystemOneEngine)
|
||||
assert isinstance(engine, DecisionEngine)
|
||||
assert engine.label == "ollama"
|
||||
assert engine.config.base_url == "http://example:11434"
|
||||
assert engine.config.model == "clef-flash"
|
||||
assert engine.context_tokens == 8192
|
||||
assert engine.config.keep_alive == "5m"
|
||||
|
||||
|
||||
def test_build_engine_ollama_requires_a_model():
|
||||
with pytest.raises(SystemExit):
|
||||
build_engine({"engine": {"provider": "ollama", "ollama": {}}}, PINS)
|
||||
Reference in new issue
Block a user