Commit 067be2c
fix: wire UnifiedClassifier to ExtProc router for consistent LoRA-based classification
This change ensures the ExtProc router uses the same UnifiedClassifier
(LoRA-based) instance as the Classification API, fixing inconsistent
model selection behavior.
**Problem:**
- Classification API (port 8080) used UnifiedClassifier (LoRA models)
- ExtProc router (port 8801) used legacy Classifier (traditional BERT)
- This caused different classification results for the same query,
leading to incorrect model selection in category-based routing
**Solution:**
1. Wire UnifiedClassifier from ClassificationService to legacy Classifier
2. Add delegation in Classifier.ClassifyCategoryWithEntropy() to use
UnifiedClassifier when available
3. Add GetUnifiedClassifier() method to ClassificationService
**Changes:**
- router.go: Wire UnifiedClassifier to Classifier during initialization
- classifier.go: Delegate to UnifiedClassifier before trying in-tree
classifier, add classifyWithUnifiedClassifier() helper method
- classification.go: Add GetUnifiedClassifier() getter method
Related to vllm-project#640
Co-Authored-By: Claude <[email protected]>
Signed-off-by: Yossi Ovadia <[email protected]>1 parent 8838cbf commit 067be2c
File tree
3 files changed
+77
-5
lines changed- src/semantic-router/pkg
- classification
- extproc
- services
3 files changed
+77
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
215 | 218 | | |
216 | 219 | | |
217 | 220 | | |
| |||
539 | 542 | | |
540 | 543 | | |
541 | 544 | | |
542 | | - | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
543 | 551 | | |
544 | 552 | | |
545 | 553 | | |
| |||
587 | 595 | | |
588 | 596 | | |
589 | 597 | | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
590 | 648 | | |
591 | 649 | | |
592 | 650 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| |||
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| 147 | + | |
146 | 148 | | |
147 | 149 | | |
148 | 150 | | |
149 | | - | |
| 151 | + | |
150 | 152 | | |
151 | | - | |
152 | | - | |
153 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
154 | 162 | | |
155 | 163 | | |
156 | 164 | | |
157 | 165 | | |
158 | 166 | | |
159 | 167 | | |
| 168 | + | |
160 | 169 | | |
161 | 170 | | |
162 | 171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
541 | 541 | | |
542 | 542 | | |
543 | 543 | | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
544 | 549 | | |
545 | 550 | | |
546 | 551 | | |
| |||
0 commit comments