-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add FastestStrategy routing + vendor-agnostic cleanup #139
Copy link
Copy link
Closed
Labels
prio:highImportant, should be prioritizedImportant, should be prioritizedscope:medium1-3 days of work1-3 days of workspec:providersDESIGN_SPEC Section 9 - Model Provider LayerDESIGN_SPEC Section 9 - Model Provider Layertype:featureNew feature implementationNew feature implementationtype:refactorCode restructuring, cleanupCode restructuring, cleanup
Description
Summary
Two related changes bundled together:
- Add
FastestStrategyrouting strategy — selects the model with the lowestestimated_latency_ms, as specified in DESIGN_SPEC §9.4 - Remove all vendor-specific names from source code, tests, and documentation — enforce vendor-agnostic naming everywhere
Success Criteria
FastestStrategy
-
ProviderModelConfighasestimated_latency_ms: int | Nonefield (defaultNone,gt=0) -
ResolvedModelhas matchingestimated_latency_msfield, wired from config -
ModelResolver.all_models_sorted_by_latency()returns models sorted ascending,Nonelast -
FastestStrategyclass implementsRoutingStrategyprotocol withname = "fastest" - Strategy picks the fastest model within budget; falls back to cheapest when no latency data exists
- Mixed
None/non-Nonelatency: only models with data are considered - Budget exceeded by all fast models: returns fastest anyway with warning in reason
- No models registered: raises
NoAvailableModelError -
STRATEGY_NAME_FASTESTconstant andFastestStrategyre-exported throughrouting/__init__.pyandproviders/__init__.py - Registered in
STRATEGY_MAPas"fastest" - DESIGN_SPEC §9.4 comment updated to list all 6 implemented strategies
Vendor-Agnostic Cleanup
- Zero mentions of
Anthropic,Claude,Opus,Sonnet,Haikuinsrc/(code + docstrings + comments) - Zero mentions in
tests/(all.pyfiles) - Generic naming convention used consistently:
- Provider:
example-provider - Model IDs:
example-large-001,example-medium-001,example-small-001 - Aliases:
large,medium,small - Test fixtures:
test-provider,test-small-001,test-medium-001,test-large-001
- Provider:
-
DESIGN_SPEC.mdexamples use generic names (vendor names only in factual industry references like MCP ownership) -
README.mdprovider description is vendor-neutral -
CLAUDE.mdhas explicit vendor-agnostic rule to prevent future regression
Quality Gates
- All 1850 tests pass
- Coverage ≥ 80% (actual: 94.97%)
-
ruff checkclean -
mypy --strictclean - All pre-commit hooks pass
Branch
feat/fastest-strategy-vendor-cleanup
Files Changed (40 files)
Source (15 files):
src/ai_company/config/schema.py— latency field + docstring cleanupsrc/ai_company/providers/routing/models.py— latency field on ResolvedModelsrc/ai_company/providers/routing/resolver.py— wire latency +all_models_sorted_by_latency()src/ai_company/providers/routing/strategies.py—FastestStrategy+_fastest_within_budget()helpersrc/ai_company/providers/routing/__init__.py— re-exportssrc/ai_company/providers/__init__.py— re-exportssrc/ai_company/core/agent.py— docstring cleanupsrc/ai_company/providers/drivers/__init__.py— docstring cleanupsrc/ai_company/providers/drivers/litellm_driver.py— docstring cleanupsrc/ai_company/providers/drivers/mappers.py— comment cleanupsrc/ai_company/providers/models.py— docstring cleanupsrc/ai_company/providers/registry.py— docstring cleanup
Tests (25 files): vendor name replacements + new FastestStrategy/latency tests
Docs (3 files): CLAUDE.md, DESIGN_SPEC.md, README.md
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
prio:highImportant, should be prioritizedImportant, should be prioritizedscope:medium1-3 days of work1-3 days of workspec:providersDESIGN_SPEC Section 9 - Model Provider LayerDESIGN_SPEC Section 9 - Model Provider Layertype:featureNew feature implementationNew feature implementationtype:refactorCode restructuring, cleanupCode restructuring, cleanup