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:
1 parent
1dc0550659
commit
e426998cf7
9 files changed
+305
-26
No files matched your search
+15
-1
@@ -13,7 +13,7 @@ from __future__ import annotations
|
||||
|
||||
import json
|
||||
|
||||
from .provider import OpenAICompatClient, ProviderError
|
||||
from .provider import OpenAICompatClient, ProviderError, SemIfEngineClient
|
||||
|
||||
|
||||
class LLMError(ProviderError):
|
||||
@@ -102,3 +102,17 @@ class LLMClient(OpenAICompatClient):
|
||||
if start != -1 and end != -1:
|
||||
text = text[start : end + 1]
|
||||
return json.loads(text)
|
||||
|
||||
|
||||
class SemIfLLMClient(SemIfEngineClient):
|
||||
"""`llm` authoring backed by the loaded SemIf engine model.
|
||||
|
||||
The `llm.provider = "semif"` option: the same in-process GGUF the decision
|
||||
engine already loaded generates the title/description (and any other `llm`
|
||||
text) instead of calling an HTTP endpoint. Same `chat(...)` surface, same
|
||||
graceful error contract — raises `LLMError` so the scheduler traces a
|
||||
`draft_failed` and the LLM bridge reports 502 rather than crashing.
|
||||
"""
|
||||
|
||||
error_class = LLMError
|
||||
label = "semif:llm"
|
||||
Reference in new issue
Block a user