generated from coulomb/repo-seed
WP-0001 — Foundation & GAAF Baseline - SCOPE.md, ARCHITECTURE-LAYERS.md, contracts/ tree - .claude/rules/ stubs filled (architecture, stack, boundary) - 57 tests (pytest), pyproject.toml with ruff+mypy, CI workflow WP-0002 — Core Extensions (FR-4 + FR-3) - FR-4: BudgetTracker (thread-safe) + LLMBudgetExceededError + optional RunConfig.budget_tracker + enforcement in all adapters - FR-3: async_execute_prompt on LLMAdapter ABC (asyncio.to_thread fallback) + native asyncio.create_subprocess_exec in ClaudeCodeAdapter 81 tests passing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
52 lines
2.4 KiB
Markdown
52 lines
2.4 KiB
Markdown
# LLM-WP-0003 — Functional Extensions (FR-2 + FR-1)
|
|
|
|
**status:** active
|
|
**owner:** llm-connect
|
|
**repo:** llm-connect
|
|
**created:** 2026-04-01
|
|
**depends-on:** LLM-WP-0001 (test infrastructure must exist)
|
|
|
|
## Purpose
|
|
|
|
Implement the two IHF feature requests that add new Functional-layer modules.
|
|
Neither touches Core. Both can be developed independently of WP-0002.
|
|
|
|
Origin: IHUB-WP-0012 Phase 11 — Advanced AI Federation (completed 2026-04-01).
|
|
|
|
## GAAF notes
|
|
|
|
Both additions are Functional-layer under GAAF-2026:
|
|
- Demand signal is explicit: IHF (inter-hub) is the primary consumer for both.
|
|
- Each gets its own functional contract doc in `/contracts/functional/`.
|
|
- Maturity on release: Beta (single known consumer, interface not yet stabilised).
|
|
|
|
## Tasks
|
|
|
|
### FR-2 — RoutingPolicy
|
|
|
|
| ID | Title | Priority | Status |
|
|
|-----|-------|----------|--------|
|
|
| T01 | `RoutingPolicy` data model: `rules` list with `task_type`, `prefer`, `max_cost_per_1k`, `fallback` | high | todo |
|
|
| T02 | `policy.resolve(task_type)` → returns configured `LLMAdapter` | high | todo |
|
|
| T03 | Export from `llm_connect.__init__` and update `__all__` | medium | todo |
|
|
| T04 | Functional contract doc for `RoutingPolicy` | medium | todo |
|
|
| T05 | Tests: rule match, cost-cap fallback, unknown task_type fallback, no-match default | high | todo |
|
|
|
|
### FR-1 — HTTP serve mode
|
|
|
|
| ID | Title | Priority | Status |
|
|
|-----|-------|----------|--------|
|
|
| T06 | Design `/execute` JSON schema (request: provider, model, prompt, config; response: LLMResponse fields) | high | todo |
|
|
| T07 | Implement `llm_connect/server.py` — minimal HTTP server, `POST /execute`, `GET /health` | high | todo |
|
|
| T08 | `python -m llm_connect.server --port N --provider X --model Y` CLI entry point | high | todo |
|
|
| T09 | Add `httpx` or `aiohttp` server dep under `[project.optional-dependencies] server` | medium | todo |
|
|
| T10 | Functional contract doc (API schema — request/response shapes, error codes) | medium | todo |
|
|
| T11 | Tests: spin up server in subprocess or via `TestClient`, POST round-trip (MockAdapter), error responses | high | todo |
|
|
|
|
## Exit criteria
|
|
|
|
- `RoutingPolicy.resolve("triage")` returns the correct adapter per rules in tests
|
|
- `python -m llm_connect.server --port 9999` starts and responds to `POST /execute`
|
|
- `GET /health` returns 200
|
|
- All functional contract docs present in `/contracts/functional/`
|