Skip to content

Conversation

@henschwartz
Copy link
Contributor

Problem

Previously, getRecommendedModel() returned hardcoded invalid model names like 'math-specialized-model' instead of actual model names from the configuration. This caused incorrect model recommendations when the router tried to select models based on classified categories.

Solution

Updated getRecommendedModel() to:

  • Read actual model names from the configuration's IntelligentRouting.Decisions
  • Support LoRA adapter names (prefer LoRA over base model when specified)
  • Implement case-insensitive category matching
  • Add proper fallback to default model when no decision found
  • Return empty string when no recommendation is available

Changes

  • Updated getRecommendedModel() method in classification.go:

    • Removed hardcoded fmt.Sprintf("%s-specialized-model", category) logic
    • Added config-based model lookup with proper fallback chain
    • Added LoRA adapter support (checks ModelRef.LoRAName first)
    • Added case-insensitive matching using strings.EqualFold()
  • Added comprehensive tests in classification_test.go:

    • TestGetRecommendedModel_WithConfig - Tests real model names from config
    • TestGetRecommendedModel_NoConfig - Tests nil config fallback
    • TestGetRecommendedModel_EmptyConfig - Tests empty config fallback
    • TestGetRecommendedModel_NoDecisionFound - Tests default model fallback
    • TestGetRecommendedModel_EmptyModelRefs - Tests empty ModelRefs handling

Testing

All existing tests pass
New tests cover all scenarios (config fallback, LoRA support, edge cases)
golangci-lint: 0 issues
go vet: no errors
go test: all tests pass (including 5 new test functions)
Pre-commit hooks: passed

Fixes #929

…odel

Previously, getRecommendedModel() returned hardcoded invalid model names
like 'math-specialized-model' instead of actual model names from the
configuration. This caused incorrect model recommendations.

Changes:
- Updated getRecommendedModel() to read model names from config
- Added support for LoRA adapter names (prefer LoRA over base model)
- Added case-insensitive category matching
- Added fallback to default model when no decision found
- Added comprehensive tests for all scenarios

Fixes: vllm-project#929

Tested:
- All existing tests pass
- New tests cover config fallback, LoRA support, and edge cases
- golangci-lint: 0 issues
- go vet: no errors

Signed-off-by: Hen Schwartz <[email protected]>
@netlify
Copy link

netlify bot commented Dec 30, 2025

Deploy Preview for vllm-semantic-router ready!

Name Link
🔨 Latest commit 6c47946
🔍 Latest deploy log https://app.netlify.com/projects/vllm-semantic-router/deploys/6953d2873d0ba60008a52445
😎 Deploy Preview https://deploy-preview-933--vllm-semantic-router.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link

👥 vLLM Semantic Team Notification

The following members have been identified for the changed files in this PR and have been automatically assigned:

📁 src

Owners: @rootfs, @Xunzhuo, @wangchen615
Files changed:

  • src/semantic-router/pkg/services/classification.go
  • src/semantic-router/pkg/services/classification_test.go

vLLM

🎉 Thanks for your contributions!

This comment was automatically generated based on the OWNER files in the repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: getRecommendedModel returns invalid model names instead of real models from configuration

4 participants