-
Notifications
You must be signed in to change notification settings - Fork 297
[Refactor] Remove ClassifyCategory and add embedding classifier config #620
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
[Refactor] Remove ClassifyCategory and add embedding classifier config #620
Conversation
- Removed ClassifyCategory method and all references, keeping only ClassifyCategoryWithEntropy - Integrated keywordEmbeddingClassifier call within ClassifyCategoryWithEntropy - Removed ClassifyAndSelectBestModel method and its tests - Removed findCategoryForClassification helper method - Updated all callers to use ClassifyCategoryWithEntropy with 4 return values - Added embedding classifier configuration in config/intelligent-routing/in-tree/embedding.yaml - Updated tests to use ClassifyCategoryWithEntropy with proper mock data This refactoring simplifies the classification API by consolidating to a single entropy-based classification method and adds comprehensive embedding-based classification rules configuration. Signed-off-by: bitliu <bitliu@tencent.com>
✅ Deploy Preview for vllm-semantic-router ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
👥 vLLM Semantic Team NotificationThe following members have been identified for the changed files in this PR and have been automatically assigned: 📁
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the category classification system by removing the ClassifyCategory method and standardizing on the entropy-based ClassifyCategoryWithEntropy method. This consolidates classification logic to use entropy-based reasoning decisions consistently across the codebase.
Key Changes:
- Removed the
ClassifyCategoryandClassifyAndSelectBestModelmethods from the classifier - Updated all call sites to use
ClassifyCategoryWithEntropyinstead - Removed the fallback logic in
performClassificationAndModelSelectionto use simple classification on error - Added embedding-based classification support to
ClassifyCategoryWithEntropy
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/semantic-router/pkg/classification/classifier.go | Removed ClassifyCategory, classifyCategoryInTree, and ClassifyAndSelectBestModel methods; added embedding classifier support to ClassifyCategoryWithEntropy |
| src/semantic-router/pkg/services/classification.go | Updated to call ClassifyCategoryWithEntropy instead of ClassifyCategory |
| src/semantic-router/pkg/extproc/req_filter_classification.go | Removed fallback logic and findCategoryForClassification method; simplified error handling to use empty category |
| src/semantic-router/pkg/classification/classifier_test.go | Updated all test cases to use ClassifyCategoryWithEntropy and classifyWithProbsResult instead of ClassifyCategory and classifyResult; removed obsolete test suite for ClassifyAndSelectBestModel |
| config/intelligent-routing/in-tree/embedding.yaml | Added new configuration file for embedding-based classification with keyword rules and model settings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - "troubleshooting steps" | ||
| - "error message explanation" | ||
| - "setup instructions" | ||
| aggregation_mathod: "max" # Options: "max", "avg", "any" |
Copilot
AI
Nov 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'aggregation_mathod' to 'aggregation_method'. This typo appears in 4 locations (lines 86, 100, 112, 123) in the new configuration file. Note that the struct tag in src/semantic-router/pkg/config/config.go line 219 also uses this misspelling: yaml:"aggregation_mathod". To fix this completely, both the config file and the struct tag should be corrected together to maintain consistency.
| - "availability and stock" | ||
| - "product comparison" | ||
| - "warranty details" | ||
| aggregation_mathod: "avg" |
Copilot
AI
Nov 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'aggregation_mathod' to 'aggregation_method'.
| - "profile update" | ||
| - "subscription management" | ||
| - "billing information" | ||
| aggregation_mathod: "max" |
Copilot
AI
Nov 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'aggregation_mathod' to 'aggregation_method'.
| - "information request" | ||
| - "help needed" | ||
| - "customer service" | ||
| aggregation_mathod: "any" |
Copilot
AI
Nov 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'aggregation_mathod' to 'aggregation_method'.

Description
This PR refactors the classification API by removing the deprecated
ClassifyCategorymethod and consolidating all classification to useClassifyCategoryWithEntropy. It also adds comprehensive embedding-based classification configuration.Changes Made
Code Refactoring
ClassifyCategorymethod fromclassifier.goclassifyCategoryInTreehelper methodkeywordEmbeddingClassifiercall withinClassifyCategoryWithEntropyClassifyAndSelectBestModelmethod and its testsfindCategoryForClassificationhelper method fromreq_filter_classification.goClassifyCategoryWithEntropywith 4 return values (category, confidence, reasoningDecision, error)ClassifyCategoryWithEntropywith proper mock dataConfiguration
config/intelligent-routing/in-tree/embedding.yamlwith comprehensive embedding classifier configurationBenefits
ClassifyCategoryWithEntropy, providing consistent entropy-based reasoning decisionskeywordEmbeddingClassifieris now properly integrated into the entropy-based classification flowTesting
Files Changed
src/semantic-router/pkg/classification/classifier.go- Removed methods and updated classification flowsrc/semantic-router/pkg/classification/classifier_test.go- Updated testssrc/semantic-router/pkg/extproc/req_filter_classification.go- Removed helper and updated callersrc/semantic-router/pkg/services/classification.go- Updated callerconfig/intelligent-routing/in-tree/embedding.yaml- New configuration fileBEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE
-swhen doinggit commit[Bugfix],[Feat], and[CI].