-
Notifications
You must be signed in to change notification settings - Fork 128
Implement configurable and interpretable semantic routing rules system #195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@wangchen615 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs. I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review. |
✅ Deploy Preview for vllm-semantic-router ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Co-authored-by: wangchen615 <[email protected]>
Co-authored-by: wangchen615 <[email protected]>
Co-authored-by: wangchen615 <[email protected]>
👥 vLLM Semantic Team NotificationThe following members have been identified for the changed files in this PR and have been automatically assigned: 📁
|
You're right that this PR implements rule-based routing as an extension to the semantic routing system. However, I don't have visibility into the specific implementation details of #147 to determine if this is a direct extension of that work. My implementation (commit 28d0f13) provides:
The key difference is this maintains the existing semantic classification as the foundation while adding a rule layer on top, rather than replacing it entirely. Rules can either:
Could you clarify how this relates to the approach taken in #147? I'd be happy to adjust the implementation if there are specific aspects that should align with or build upon that previous work. |
This PR implements a comprehensive hybrid routing system that transforms the semantic router from a black-box ML classifier into an interpretable, configurable platform that supports both model-based and rule-based routing approaches.
Problem Addressed
The existing semantic router suffered from several critical limitations:
Solution Overview
The implementation extends the existing system with a hybrid architecture that preserves all current functionality while adding powerful rule-based capabilities:
Core Components
pkg/rules/engine.go
): Evaluates routing rules with multiple condition typespkg/rules/hybrid_router.go
): Orchestrates rule-based and model-based routingpkg/rules/api.go
): HTTP endpoints for dynamic rule managementConfiguration Extensions
Extended
RouterConfig
to support:Rule Types Implemented
Condition Types:
Action Types:
Decision Transparency
Every routing decision now includes detailed explanations:
API Endpoints
New rule management endpoints:
GET/POST /api/v1/rules
- List/create rulesGET/PUT/DELETE /api/v1/rules/{name}
- Manage specific rulesPOST /api/v1/rules/evaluate
- Test rule evaluationPOST /api/v1/rules/test
- Test rules with sample dataIntegration & Compatibility
OpenAIRouter
to useHybridRouter
while maintaining existing interfacesTesting & Demonstration
examples/hybrid-routing-demo.go
shows real routing decisionsThe demonstration shows the system successfully:
This implementation addresses all requirements from the original issue, providing the interpretability, configurability, and scalability needed for production environments while maintaining the proven ML capabilities of the existing system.
Fixes #194.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
huggingface.co
If you need me to access, download, or install something from one of these locations, you can either:
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.