Skip to content

Commit d69e177

Browse files
committed
feat: implement decision-based routing with plugin architecture
Signed-off-by: bitliu <[email protected]>
1 parent 7a983a6 commit d69e177

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/semantic-router/cmd/main.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,8 @@ func main() {
121121
logging.Infof("Starting vLLM Semantic Router ExtProc with config: %s", *configPath)
122122

123123
// Initialize embedding models if configured (Long-context support)
124-
cfg, err = config.Load(*configPath)
125-
if err != nil {
126-
logging.Warnf("Failed to load config for embedding models: %v", err)
127-
} else if cfg.Qwen3ModelPath != "" || cfg.GemmaModelPath != "" {
124+
// Use the already loaded config instead of calling config.Load() again
125+
if cfg.Qwen3ModelPath != "" || cfg.GemmaModelPath != "" {
128126
logging.Infof("Initializing embedding models...")
129127
logging.Infof(" Qwen3 model: %s", cfg.Qwen3ModelPath)
130128
logging.Infof(" Gemma model: %s", cfg.GemmaModelPath)

src/semantic-router/pkg/apiserver/server.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ import (
1717

1818
// Init starts the API server
1919
func Init(configPath string, port int, enableSystemPromptAPI bool) error {
20-
// Load configuration
21-
cfg, err := config.Load(configPath)
22-
if err != nil {
23-
return fmt.Errorf("failed to load config: %w", err)
20+
// Get the global configuration instead of loading from file
21+
// This ensures we use the same config as the rest of the application
22+
cfg := config.Get()
23+
if cfg == nil {
24+
return fmt.Errorf("configuration not initialized")
2425
}
2526

2627
// Create classification service - try to get global service with retry
@@ -39,7 +40,7 @@ func Init(configPath string, port int, enableSystemPromptAPI bool) error {
3940
}
4041

4142
// Initialize batch metrics configuration
42-
if cfg != nil && cfg.API.BatchClassification.Metrics.Enabled {
43+
if cfg.API.BatchClassification.Metrics.Enabled {
4344
metricsConfig := metrics.BatchMetricsConfig{
4445
Enabled: cfg.API.BatchClassification.Metrics.Enabled,
4546
DetailedGoroutineTracking: cfg.API.BatchClassification.Metrics.DetailedGoroutineTracking,

0 commit comments

Comments
 (0)