Automate create_category via normal-mode generation of the decision model

This commit is contained in:
Denton Social
2026-09-23 20:45:28 -05:00
parent 147b6cba5f
commit ea2e5b8045
9 changed files with 307 additions and 18 deletions
+34 -1
View File
@@ -12,8 +12,10 @@ from pathlib import Path
import pytest
from semif_agent.cli import build_scheduler, load_config
from semif_agent.decisions import Request
from semif_agent.dream import dream
from semif_agent.engine import EngineUnavailable
from semif_agent.skills import CategoryDraft, generate_category
def require_real(config: dict):
@@ -88,4 +90,35 @@ def test_busy_choice_path(tmp_path):
status, detail = scheduler.submit("send my girlfriend an email that says I'm going to be late")
print(f"[{status}] {detail}")
assert status in ("preempted", "queued", "dropped")
scheduler.idle()
scheduler.idle()
def test_engine_generation_normal_mode(tmp_path):
"""The pinned decision model must also generate text in the normal way."""
config = load_config()
require_real(config)
scheduler, config = build_scheduler(config)
out = scheduler.engine.generate(
[
{"role": "system", "content": "Reply with the single word ok."},
{"role": "user", "content": "say ok"},
],
max_tokens=16,
)
print(f"generation: {out!r}")
assert isinstance(out, str) and out.strip()
def test_generate_category(tmp_path):
"""Authoring a category stub through the real decision model."""
config = load_config()
require_real(config)
scheduler, config = build_scheduler(config)
draft = generate_category(
scheduler.engine,
Request("tell me if my package was delivered"),
scheduler.tree,
)
print(f"draft: {draft.name!r}{draft.description!r}")
assert isinstance(draft, CategoryDraft)
assert draft.name and draft.description