llm: add the loaded semif engine as a text-generation provider

Restore SemIfEngine.generate (autoregressive sampling from the loaded
llama.cpp context) and wrap it in provider.SemIfEngineClient, a non-HTTP
sibling of OpenAICompatClient with the same chat() surface. llm.SemIfLLMClient
keeps the LLMError contract so the scheduler's graceful draft_failed path and
the LLM bridge's 502 path are unchanged.

llm.provider now selects "semif" (the in-process decision model, no endpoint
or model needed), "opencode", or the default "ollama"; build_llm_client owns
the choice (build_scheduler delegates). Knobs live under llm.semif
(temperature 0 = greedy, max_tokens). bootstrap skips the ollama llm
warn/pull/probe when provider is semif.

Only the llm task supports it; codegen still needs a real code model.
This commit is contained in:
gabby committed 2026-10-06 21:35:21 +00:00
1 parent 1dc0550659
commit e426998cf7
9 files changed
+305 -26

No files matched your search

+10 -4
View File
@@ -367,9 +367,12 @@ semif_agent/
create gates, intent guard, tiered config resolution
codegen.py OpenAI-compatible client; body/elicitation/test generation;
parse/validate; CONTRACT + INTEGRATION extraction; test runner
provider.py shared OpenAI-compatible transport (SSE/budget/idle/watchdog)
engine.py SemIfEngine -> semif_phase1.llamacpp_backend (lazy import)
llm.py small OpenAI-compatible provider; authors new title + description
provider.py shared OpenAI-compatible transport (SSE/budget/idle/watchdog);
SemIfEngineClient generates text from the in-process engine
engine.py SemIfEngine -> semif_phase1.llamacpp_backend (lazy import);
call() scores, generate() samples text
llm.py small provider; authors new title + description
(ollama / opencode / the loaded engine via `semif`)
log.py decisions.jsonl rows {state, question, options, probs, ...}
trace.py runs.jsonl lifecycle events keyed by run_id
dream.py NLL / weighted CE / accuracy / ECE cost report
@@ -414,7 +417,10 @@ machines:
newly created category/skill. Deliberately its own endpoint/model, so it can
stay local even when `codegen` is remote; it uses the same provider transport
(`provider.py`) and an unreachable endpoint is graceful (the request is not
re-dispatched), never fatal.
re-dispatched), never fatal. Its `provider` can be `"ollama"` (default),
`"opencode"` (the hosted Console API), or `"semif"` — the already-loaded
decision engine model generates in-process, with no endpoint and no
`llm.model` at all (see the `llm.semif` block in `config.json`).
The **decision engine is separate** and runs via llama.cpp CPU (or Vulkan if your
build enables it), not ollama.