feat(api): route the npc role to its own model
This commit is contained in:
@@ -18,5 +18,9 @@ def narrator_model() -> str:
|
|||||||
return os.environ.get("OLLAMA_NARRATOR_MODEL", "qwen3.5:latest")
|
return os.environ.get("OLLAMA_NARRATOR_MODEL", "qwen3.5:latest")
|
||||||
|
|
||||||
|
|
||||||
|
def npc_model() -> str:
|
||||||
|
return os.environ.get("OLLAMA_NPC_MODEL", "qwen3.5:latest")
|
||||||
|
|
||||||
|
|
||||||
def call_log_path() -> str | None:
|
def call_log_path() -> str | None:
|
||||||
return os.environ.get("CALL_LOG_PATH") or None
|
return os.environ.get("CALL_LOG_PATH") or None
|
||||||
|
|||||||
@@ -22,4 +22,10 @@ def for_role(role: str) -> RoleConfig:
|
|||||||
options={"temperature": 0.8, "top_p": 0.9, "num_predict": 300},
|
options={"temperature": 0.8, "top_p": 0.9, "num_predict": 300},
|
||||||
think=False, # qwen3.x thinking OFF; harmless on non-thinking models
|
think=False, # qwen3.x thinking OFF; harmless on non-thinking models
|
||||||
)
|
)
|
||||||
|
if role == "npc":
|
||||||
|
return RoleConfig(
|
||||||
|
model=config.npc_model(),
|
||||||
|
options={"temperature": 0.8, "top_p": 0.9, "num_predict": 320},
|
||||||
|
think=False,
|
||||||
|
)
|
||||||
raise KeyError(f"no routing for role: {role}")
|
raise KeyError(f"no routing for role: {role}")
|
||||||
|
|||||||
@@ -19,3 +19,11 @@ def test_env_overrides_model(monkeypatch):
|
|||||||
def test_unknown_role_raises():
|
def test_unknown_role_raises():
|
||||||
with pytest.raises(KeyError):
|
with pytest.raises(KeyError):
|
||||||
for_role("wizard")
|
for_role("wizard")
|
||||||
|
|
||||||
|
|
||||||
|
def test_npc_role_routes_to_npc_model(monkeypatch):
|
||||||
|
monkeypatch.setenv("OLLAMA_NPC_MODEL", "some-npc-model")
|
||||||
|
cfg = for_role("npc")
|
||||||
|
assert cfg.model == "some-npc-model"
|
||||||
|
assert cfg.think is False
|
||||||
|
assert "num_predict" in cfg.options
|
||||||
|
|||||||
Reference in New Issue
Block a user