LLMRouter: accept inline config dict in addition to Path #59

Closed
opened 2026-05-05 14:46:07 -07:00 by pyr0ball · 0 comments
Owner

Background

Product ingest scripts (e.g. pagepiper ingest_pdf.py, ingest_epub.py) need to pass a runtime-constructed config dict to LLMRouter rather than a file path, because the Ollama URL and model names come from product-specific env vars (PAGEPIPER_OLLAMA_URL, PAGEPIPER_EMBED_MODEL) rather than a shared llm.yaml.

What happened

LLMRouter.__init__ only accepted a Path. Passing a dict caused AttributeError: 'dict' object has no attribute 'exists' at config_path.exists().

Fix shipped (2026-05-05)

Changed the signature to def __init__(self, config_path: Path | dict = CONFIG_PATH) and added a isinstance(config_path, dict) branch that assigns the dict directly to self.config.

Needs: test coverage for the dict init path, and a version bump.

Labels

  • bug, fix, llm
## Background Product ingest scripts (e.g. pagepiper `ingest_pdf.py`, `ingest_epub.py`) need to pass a runtime-constructed config dict to `LLMRouter` rather than a file path, because the Ollama URL and model names come from product-specific env vars (`PAGEPIPER_OLLAMA_URL`, `PAGEPIPER_EMBED_MODEL`) rather than a shared `llm.yaml`. ## What happened `LLMRouter.__init__` only accepted a `Path`. Passing a dict caused `AttributeError: 'dict' object has no attribute 'exists'` at `config_path.exists()`. ## Fix shipped (2026-05-05) Changed the signature to `def __init__(self, config_path: Path | dict = CONFIG_PATH)` and added a `isinstance(config_path, dict)` branch that assigns the dict directly to `self.config`. Needs: test coverage for the dict init path, and a version bump. ## Labels - bug, fix, llm
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/circuitforge-core#59
No description provided.