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
@@ -227,6 +227,16 @@ winnow.py WinnowEngine -> a remote Winnow `/v1/systemone` typed-decision
|
||||
ids, and generate() via /v1/chat/completions. stdlib urllib; an
|
||||
internal lock serializes on the single-slot server; every
|
||||
failure raises EngineUnavailable (fatal, like the local engine)
|
||||
ollama_systemone.py
|
||||
OllamaSystemOneEngine -> ollama's native System One
|
||||
`/v1/systemone` route (`engine.provider == "ollama"`): same
|
||||
DecisionRequest -> choice mapping and strict distribution
|
||||
validation, plus ollama's own edges — reachability/warmth via
|
||||
/api/version + /api/show (model exists, `decision` capability,
|
||||
real `num_ctx`), request `keep_alive`, `string | null` criteria
|
||||
descriptions, and no text generation (decision models don't
|
||||
generate). stdlib urllib; internal lock; every failure raises
|
||||
EngineUnavailable.
|
||||
codegen.py CodegenClient (OpenAI-compatible) writes real-integration skill
|
||||
bodies against CODEGEN.md (real actions via stdlib transports,
|
||||
data from the runner via ctx.config, never embedded; bodies
|
||||
@@ -823,28 +833,45 @@ CLI, unit tests (24) + integration tests (2).
|
||||
in config.json — the same provider pattern as `llm`/`codegen`. `"semif"`
|
||||
(default) is the local llama.cpp GGUF (`SemIfEngine`); `"winnow"` is a remote
|
||||
Winnow `/v1/systemone` typed-decision API (`semif_agent.winnow.WinnowEngine`,
|
||||
configured by the nested `engine.winnow` block). `cli.build_engine` picks the
|
||||
class; `SemIfEngine`/`WinnowEngine` both satisfy `engine.DecisionEngine`
|
||||
(`call`/`warm`/`loaded`/`generate`).
|
||||
configured by the nested `engine.winnow` block); `"ollama"` is ollama's native
|
||||
System One `/v1/systemone` route
|
||||
(`semif_agent.ollama_systemone.OllamaSystemOneEngine`, configured by the
|
||||
nested `engine.ollama` block). `cli.build_engine` picks the class;
|
||||
`SemIfEngine`/`WinnowEngine`/`OllamaSystemOneEngine` all satisfy
|
||||
`engine.DecisionEngine` (`call`/`warm`/`loaded`/`generate`).
|
||||
- **`winnow` and `ollama` are different edges of the same System One contract.**
|
||||
Both map the flat decision onto a `choice` question and validate/normalize the
|
||||
returned distribution over exactly the requested option ids, but the
|
||||
`ollama` provider implements the deployment details only ollama has: there is
|
||||
no `/health`, so `warm()` probes `GET /api/version` and `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, choice criteria
|
||||
descriptions use the ollama subset `string | null`, and a choice question
|
||||
needs at least two options. Decision models do not generate text, so
|
||||
`OllamaSystemOneEngine.generate` raises `EngineUnavailable` — use
|
||||
`llm.provider == "ollama"` for the chat path.
|
||||
- **The engine is always real and every `EngineUnavailable` is fatal**,
|
||||
whichever provider is selected: `WinnowEngine` converts every network, HTTP,
|
||||
and malformed/unnormalized-distribution failure into `EngineUnavailable` so
|
||||
the scheduler's fatal path (and the codegen watchdog / LLM bridge's graceful
|
||||
paths) behave identically to the local engine. There is no fallback model.
|
||||
whichever provider is selected: `WinnowEngine`/`OllamaSystemOneEngine` convert
|
||||
every network, HTTP, and malformed/unnormalized-distribution failure into
|
||||
`EngineUnavailable` so the scheduler's fatal path (and the codegen watchdog /
|
||||
LLM bridge's graceful paths) behave identically to the local engine. There is
|
||||
no fallback model.
|
||||
- The agent's flat decision (`state` + `question` + typed `options`) maps onto
|
||||
Winnow's `choice` question type (`options` -> `criteria` id->description,
|
||||
`question` -> `instructions`); the returned distribution is validated against
|
||||
exactly the requested option ids and normalized. `generate` goes through the
|
||||
same server's `/v1/chat/completions`, so `llm.provider == "semif"` keeps
|
||||
working when the decision engine is Winnow.
|
||||
the System One `choice` question type (`options` -> `criteria`
|
||||
id->description, `question` -> `instructions`); the returned distribution is
|
||||
validated against exactly the requested option ids and normalized. For
|
||||
`winnow`, `generate` goes through the same server's `/v1/chat/completions`, so
|
||||
`llm.provider == "semif"` keeps working when the decision engine is Winnow.
|
||||
- Swapping the decision model changes routing/assessment behaviour and the
|
||||
decision-log distribution; that is the intended per-machine choice. The
|
||||
decision log and `dream` cost are unchanged because `DecisionResult` is the
|
||||
same contract.
|
||||
- Context differs by provider (the local engine's `engine.context_tokens` vs the
|
||||
remote server's own `--ctx-size`, mirrored in `engine.winnow.context_tokens`);
|
||||
a state that overflows is a fatal `EngineUnavailable`, the same class as the
|
||||
local token limit. Every engine exposes its window as `context_tokens` (a
|
||||
remote server's own decision window, mirrored in `engine.winnow.context_tokens`
|
||||
or discovered from `engine.ollama`'s `/api/show` `num_ctx`); a state that
|
||||
overflows is a fatal `EngineUnavailable`, the same class as the local token
|
||||
limit. Every engine exposes its window as `context_tokens` (a
|
||||
`DecisionEngine` property), which the scheduler uses to size generated
|
||||
artifacts — see "Artifact size budget".
|
||||
|
||||
@@ -890,8 +917,8 @@ CLI, unit tests (24) + integration tests (2).
|
||||
which installs the Vulkan build prereqs
|
||||
(`libvulkan-dev glslc spirv-headers glslang-tools`) when needed. A CPU-only
|
||||
host keeps the default CPU wheel — a GPU build is slower on CPU. A host whose
|
||||
`engine.provider` is `"winnow"` installs none of this (no clone, no GGUF, no
|
||||
tokenizer, no engine deps).
|
||||
`engine.provider` is `"winnow"` or `"ollama"` installs none of this (no clone,
|
||||
no GGUF, no tokenizer, no engine deps).
|
||||
- **Expected pip warnings:** pip reports "dependency conflicts" against
|
||||
semif-phase1's declared requirements (torch/accelerate/protobuf/sentencepiece
|
||||
not installed, numpy 2.2.6 vs 2.3.5). These are informational — the staging
|
||||
@@ -971,7 +998,8 @@ CLI, unit tests (24) + integration tests (2).
|
||||
a checkout (register its SSH key on your git host first), then run
|
||||
`scripts/bootstrap.sh`. On a fresh machine it runs the **setup interview**
|
||||
(`semif_agent/setup.py`, the `cli setup` subcommand) and writes the split
|
||||
config from the answers — decision engine (local SemIf 4B or remote Winnow),
|
||||
config from the answers — decision engine (local SemIf 4B, remote Winnow, or
|
||||
an Ollama System One decision model),
|
||||
new-skill authoring mode (+ `llm`/`codegen` endpoints when enabled), capability
|
||||
packs, gateways, and timezone — then installs only what those answers require
|
||||
(the install *plan* drives every conditional stage). Which packs exist is owned
|
||||
|
||||
Reference in new issue
Block a user