feat(api): config + role→model routing (qwen3.5 narrator default, think off)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-10 08:08:56 -05:00
parent ea2cfafd34
commit 42b3720721
3 changed files with 68 additions and 0 deletions

25
api/app/routing.py Normal file
View File

@@ -0,0 +1,25 @@
"""Role → model routing (charter §4/§5). Model choice is config, not law — a
deploy, not a client patch. Read at call time so an env override needs no reimport.
The provider abstraction (Ollama → Replicate) slots in here later (YAGNI now).
"""
from dataclasses import dataclass
from . import config
@dataclass(frozen=True)
class RoleConfig:
model: str
options: dict
think: bool | None = None # Ollama top-level `think`; None omits it
def for_role(role: str) -> RoleConfig:
if role == "narrator":
return RoleConfig(
model=config.narrator_model(),
options={"temperature": 0.8, "top_p": 0.9, "num_predict": 300},
think=False, # qwen3.x thinking OFF; harmless on non-thinking models
)
raise KeyError(f"no routing for role: {role}")