Migrate LLMRouter model selection to cf-orch task routing via /api/inference/task #7
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Background
cf-orch #60 shipped the three-layer task-model assignment system and
POST /api/inference/task. Products can now route inference by task name instead of hardcoded model IDs.Spec:
circuitforge-plans/circuitforge-orch/superpowers/specs/2026-05-13-task-model-assignments-design.mdCurrent state
Pagepiper already supports
CF_ORCH_URLas an LLMRouter backend (viaget_llm_config()inapp/config.py). However, model selection is still explicit via env vars (PAGEPIPER_EMBED_MODEL, etc.) and the chat endpoint callsLLMRouterwith a specific model rather than delegating model choice to the assignment layer.Call sites:
app/api/chat.py—_get_llm_router()/_require_llm(), passed toSynthesizerapp/services/synthesizer.py—Synthesizer.__init__(llm)(already DI-friendly)scripts/ingest_pdf.py,scripts/ingest_epub.py,scripts/ingest_docx.py— embedding during ingestWhat to do
1. Register tasks in
assignments.yaml2. Migrate
chat.pyto/api/inference/taskWhen
CF_ORCH_URLis set, callPOST /api/inference/taskwith{"product": "pagepiper", "task": "rag_query", ...}instead of routing throughLLMRouterwith an explicit model. Keep theLLMRouterpath as fallback for standalone/Ollama installs.3. Embed task (optional first pass)
The ingest scripts use
nomic-embed-textexplicitly. In a future pass, wire theembedtask so the embedding model can be swapped via Avocet Assignments UI without restarting pagepiper.4. Backwards compatibility
This is opt-in —
LLMRouterdirect path continues to work for standalone installs without cf-orch.Acceptance Criteria
assignments.yamlhaspagepiper.rag_queryentrychat.pyroutes through/api/inference/taskwhenCF_ORCH_URLis setLLMRouterstill works for standalone Ollama installsRelated
app/api/chat.py,app/services/synthesizer.pycircuitforge-plans/circuitforge-orch/superpowers/specs/2026-05-13-task-model-assignments-design.md