authoring: dedicated llm provider for skill title/description
Move new category/skill draft authoring off SemIfEngine.generate onto a separate small OpenAI-compatible provider, deliberately distinct from codegen. Extract the shared transport (SSE/budget/idle/degeneration) into provider.OpenAICompatClient; LLMClient and CodegenClient subclass it with their own endpoints, sampler defaults, and error types. Draft authoring now runs on its own async single-slot worker: a create request queues, the gate stays free, a category job chains into its skill job, and the original request re-runs when the body lands. An unreachable llm endpoint is graceful (draft_failed trace, user notified, no re-dispatch); only SemIf availability is fatal. Elicitation is deferred on every front end (REPL included) now that authoring is async.
This commit is contained in:
1 parent
ea3d79be99
commit
fb5303928b
14 files changed
+1140
-957
No files matched your search
+14
-3
@@ -70,9 +70,19 @@ def build_scheduler(config: dict) -> tuple[Scheduler, dict]:
|
||||
threads=config.get("engine", {}).get("threads"),
|
||||
)
|
||||
)
|
||||
llm_cfg = config.get("llm", {}) or {}
|
||||
llm = LLMClient(
|
||||
base_url=config.get("llm", {}).get("base_url", "http://localhost:11434/v1"),
|
||||
model=config.get("llm", {}).get("model", "qwen2.5:3b"),
|
||||
base_url=llm_cfg.get("base_url", "http://localhost:11434/v1"),
|
||||
model=llm_cfg.get("model", "qwen2.5:3b"),
|
||||
timeout=float(llm_cfg.get("timeout", 600.0)),
|
||||
stream=bool(llm_cfg.get("stream", False)),
|
||||
idle_warn=float(llm_cfg.get("idle_warn", 30.0)),
|
||||
idle_timeout=float(llm_cfg.get("idle_timeout", 120.0)),
|
||||
context_window=float(llm_cfg.get("context_window", 0.0)),
|
||||
temperature=float(llm_cfg.get("temperature", 0.2)),
|
||||
top_p=float(llm_cfg.get("top_p", 0.9)),
|
||||
presence_penalty=float(llm_cfg.get("presence_penalty", 0.0)),
|
||||
frequency_penalty=float(llm_cfg.get("frequency_penalty", 0.0)),
|
||||
)
|
||||
log = DecisionLog(config.get("log", "data/decisions.jsonl"))
|
||||
trace = TraceLog(config.get("trace", "data/runs.jsonl"))
|
||||
@@ -238,7 +248,7 @@ def _fatal_exit(scheduler: Scheduler) -> int | None:
|
||||
|
||||
|
||||
def repl(scheduler: Scheduler, config: dict) -> int:
|
||||
scheduler.asker = lambda question: input(f"{question} ")
|
||||
scheduler.defer_questions = True
|
||||
print(try_warm(scheduler))
|
||||
print(
|
||||
"type a request, or one of: busy <text> | idle | status | skills | dream | "
|
||||
@@ -246,6 +256,7 @@ def repl(scheduler: Scheduler, config: dict) -> int:
|
||||
"repairs | repair <offer-id> [action] | quit"
|
||||
)
|
||||
while True:
|
||||
_answer_questions(scheduler)
|
||||
try:
|
||||
line = input("> ").strip()
|
||||
except (EOFError, KeyboardInterrupt):
|
||||
|
||||
Reference in new issue
Block a user