Commit fed62ee
refactor(llm-router): consolidate into SemanticRouter with backward compatibility
Per PR review feedback, refactored LLM Router to integrate into SemanticRouter
instead of being a separate class. This maintains the powerful LLM routing
features while keeping the codebase cleaner and more maintainable.
Key changes:
- Extended Route/RouteMatch schemas with optional model, confidence, alternatives
- Added cost optimization support to RoutingConfig
- Implemented from_pretrained() for loading routers with pre-computed embeddings
- Created AsyncSemanticRouter with full async support
- Added backward compatibility wrappers (LLMRouter → SemanticRouter)
- Migrated pretrained configs to router/pretrained/
Backward compatibility:
- Old imports (from redisvl.extensions.llm_router) still work with deprecation warnings
- Parameter mapping (tiers → routes) handled transparently
- Serialization maintains "tiers" format for compatibility
- All existing tests pass (54/54)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent d8b4eb9 commit fed62ee
6 files changed
Lines changed: 43728 additions & 49 deletions
File tree
- redisvl/extensions
- llm_router
- router
- pretrained
0 commit comments