vllm-sr 0.1.0b2.dev20260126190945__tar.gz → 0.1.0b2.dev20260202073049__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. {vllm_sr-0.1.0b2.dev20260126190945/vllm_sr.egg-info → vllm_sr-0.1.0b2.dev20260202073049}/PKG-INFO +1 -1
  2. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/merger.py +39 -0
  3. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/models.py +23 -0
  4. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/templates/config.template.yaml +56 -2
  5. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/templates/router-defaults.yaml +27 -14
  6. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/pyproject.toml +1 -1
  7. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049/vllm_sr.egg-info}/PKG-INFO +1 -1
  8. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/MANIFEST.in +0 -0
  9. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/README.md +0 -0
  10. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/__init__.py +0 -0
  11. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/commands/__init__.py +0 -0
  12. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/commands/config.py +0 -0
  13. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/commands/generate.py +0 -0
  14. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/commands/init.py +0 -0
  15. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/commands/serve.py +0 -0
  16. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/commands/show_config.py +0 -0
  17. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/commands/show_defaults.py +0 -0
  18. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/commands/validate.py +0 -0
  19. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/config_generator.py +0 -0
  20. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/consts.py +0 -0
  21. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/core.py +0 -0
  22. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/defaults.py +0 -0
  23. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/docker_cli.py +0 -0
  24. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/logo.py +0 -0
  25. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/main.py +0 -0
  26. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/parser.py +0 -0
  27. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/templates/envoy.template.yaml +0 -0
  28. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/templates/generate_dashboard.py +0 -0
  29. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/templates/grafana-dashboard.serve.yaml +0 -0
  30. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/templates/grafana-datasource-jaeger.serve.yaml +0 -0
  31. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/templates/grafana-datasource.serve.yaml +0 -0
  32. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/templates/grafana.serve.ini +0 -0
  33. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/templates/llm-router-dashboard.serve.json +0 -0
  34. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/templates/prometheus.serve.yaml +0 -0
  35. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/templates/tools_db.json +0 -0
  36. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/utils.py +0 -0
  37. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/cli/validator.py +0 -0
  38. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/requirements.txt +0 -0
  39. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/setup.cfg +0 -0
  40. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/tests/test_plugin_parsing.py +0 -0
  41. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/tests/test_plugin_yaml_generation.py +0 -0
  42. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/vllm_sr.egg-info/SOURCES.txt +0 -0
  43. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/vllm_sr.egg-info/dependency_links.txt +0 -0
  44. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/vllm_sr.egg-info/entry_points.txt +0 -0
  45. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/vllm_sr.egg-info/requires.txt +0 -0
  46. {vllm_sr-0.1.0b2.dev20260126190945 → vllm_sr-0.1.0b2.dev20260202073049}/vllm_sr.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vllm-sr
3
- Version: 0.1.0b2.dev20260126190945
3
+ Version: 0.1.0b2.dev20260202073049
4
4
  Summary: vLLM Semantic Router - Intelligent routing for Mixture-of-Models
5
5
  Author: vLLM-SR Team
6
6
  License: Apache-2.0
@@ -185,6 +185,37 @@ def translate_context_signals(context_rules: list) -> list:
185
185
  return rules
186
186
 
187
187
 
188
+ def translate_complexity_signals(complexity_rules: list) -> list:
189
+ """
190
+ Translate complexity signals to router format.
191
+
192
+ Args:
193
+ complexity_rules: List of ComplexityRule objects
194
+
195
+ Returns:
196
+ list: Router complexity rules
197
+ """
198
+ rules = []
199
+ for signal in complexity_rules:
200
+ rule = {
201
+ "name": signal.name,
202
+ "threshold": signal.threshold,
203
+ "hard": {"candidates": signal.hard.candidates},
204
+ "easy": {"candidates": signal.easy.candidates},
205
+ }
206
+ if signal.description:
207
+ rule["description"] = signal.description
208
+ if signal.composer:
209
+ rule["composer"] = {
210
+ "operator": signal.composer.operator,
211
+ "conditions": [
212
+ {"type": c.type, "name": c.name} for c in signal.composer.conditions
213
+ ],
214
+ }
215
+ rules.append(rule)
216
+ return rules
217
+
218
+
188
219
  def translate_external_models(external_models: list) -> list:
189
220
  """
190
221
  Translate external models to router format.
@@ -441,6 +472,14 @@ def merge_configs(user_config: UserConfig, defaults: Dict[str, Any]) -> Dict[str
441
472
  )
442
473
  log.info(f" Added {len(user_config.signals.context)} context signals")
443
474
 
475
+ if user_config.signals.complexity and len(user_config.signals.complexity) > 0:
476
+ merged["complexity_rules"] = translate_complexity_signals(
477
+ user_config.signals.complexity
478
+ )
479
+ log.info(
480
+ f" Added {len(user_config.signals.complexity)} complexity signals"
481
+ )
482
+
444
483
  # Translate domains to categories
445
484
  if user_config.signals.domains:
446
485
  merged["categories"] = translate_domains_to_categories(
@@ -85,6 +85,28 @@ class ContextRule(BaseModel):
85
85
  description: Optional[str] = None
86
86
 
87
87
 
88
+ class ComplexityCandidates(BaseModel):
89
+ """Complexity candidates configuration."""
90
+
91
+ candidates: List[str]
92
+
93
+
94
+ class ComplexityRule(BaseModel):
95
+ """Complexity-based signal configuration using embedding similarity.
96
+
97
+ The composer field allows filtering based on other signals (e.g., only apply
98
+ code_complexity when domain is "computer_science"). This is evaluated after
99
+ all signals are computed in parallel, enabling signal dependencies.
100
+ """
101
+
102
+ name: str
103
+ threshold: float = 0.1
104
+ hard: ComplexityCandidates
105
+ easy: ComplexityCandidates
106
+ description: Optional[str] = None
107
+ composer: Optional["Rules"] = None # Forward reference, defined below
108
+
109
+
88
110
  class Signals(BaseModel):
89
111
  """All signal configurations."""
90
112
 
@@ -97,6 +119,7 @@ class Signals(BaseModel):
97
119
  language: Optional[List[Language]] = []
98
120
  latency: Optional[List[Latency]] = []
99
121
  context: Optional[List[ContextRule]] = []
122
+ complexity: Optional[List[ComplexityRule]] = []
100
123
 
101
124
 
102
125
  class Condition(BaseModel):
@@ -186,8 +186,8 @@ signals:
186
186
  max_tpot: 0.15 # 150ms per token
187
187
  description: "For standard applications with moderate latency tolerance"
188
188
 
189
- # context_rules - Context length signals (Token Count)
190
- context_rules:
189
+ # context - Context length signals (Token Count)
190
+ context:
191
191
  - name: "low_token_count"
192
192
  min_tokens: "0"
193
193
  max_tokens: "1K"
@@ -197,6 +197,60 @@ signals:
197
197
  max_tokens: "128K"
198
198
  description: "Long requests requiring large context window"
199
199
 
200
+ # complexity - Complexity signals (Embedding-based difficulty detection)
201
+ # IMPORTANT: It is strongly recommended to configure a composer for each complexity rule
202
+ # to filter based on other signals (e.g., domain). This prevents misclassification where
203
+ # a math question might match code_complexity or vice versa.
204
+ complexity:
205
+ - name: "code_complexity"
206
+ composer:
207
+ operator: "AND"
208
+ conditions:
209
+ - type: "domain"
210
+ name: "computer science"
211
+ threshold: 0.1
212
+ hard:
213
+ candidates:
214
+ - "design distributed system"
215
+ - "implement consensus algorithm"
216
+ - "optimize for scale"
217
+ - "architect microservices"
218
+ - "fix race condition"
219
+ - "implement garbage collector"
220
+ easy:
221
+ candidates:
222
+ - "print hello world"
223
+ - "loop through array"
224
+ - "read file"
225
+ - "sort list"
226
+ - "string concatenation"
227
+ - "simple function"
228
+ description: "Detects code complexity level"
229
+ - name: "math_complexity"
230
+ composer:
231
+ operator: "AND"
232
+ conditions:
233
+ - type: "domain"
234
+ name: "math"
235
+ threshold: 0.1
236
+ hard:
237
+ candidates:
238
+ - "prove mathematically"
239
+ - "derive the equation"
240
+ - "formal proof"
241
+ - "solve differential equation"
242
+ - "prove by induction"
243
+ - "analyze convergence"
244
+ easy:
245
+ candidates:
246
+ - "what is 2+2"
247
+ - "simple arithmetic"
248
+ - "basic calculation"
249
+ - "count numbers"
250
+ - "add two numbers"
251
+ - "multiply values"
252
+ description: "Detects mathematical complexity level"
253
+
200
254
  # Decisions - Routing logic
201
255
  decisions:
202
256
  # Highest priority: Preference-based routing via external LLM
@@ -10,6 +10,7 @@
10
10
  # "models/mom-feedback-detector": "llm-semantic-router/feedback-detector"
11
11
  # "models/mom-embedding-pro": "Qwen/Qwen3-Embedding-0.6B"
12
12
  # "models/mom-embedding-flash": "google/embeddinggemma-300m"
13
+ # "models/mom-embedding-ultra": "llm-semantic-router/mmbert-embed-32k-2d-matryoshka"
13
14
 
14
15
  # Response API Configuration
15
16
  # Enables OpenAI Response API support with conversation chaining
@@ -19,6 +20,14 @@ response_api:
19
20
  ttl_seconds: 86400 # 24 hours
20
21
  max_responses: 1000
21
22
 
23
+ # Router Replay Configuration (System-Level)
24
+ # Provides storage backend configuration for router_replay plugin
25
+ # Per-decision settings (max_records, capture settings) are configured via router_replay plugin
26
+ router_replay:
27
+ store_backend: "memory" # Options: "memory", "redis", "postgres", "milvus"
28
+ ttl_seconds: 2592000 # 30 days retention (for persistent backends)
29
+ async_writes: false # Enable async writes for better performance
30
+
22
31
  semantic_cache:
23
32
  enabled: true
24
33
  backend_type: "memory" # Options: "memory", "milvus", or "hybrid"
@@ -37,14 +46,9 @@ semantic_cache:
37
46
  # backend_config_path: "config/milvus.yaml" # Path to Milvus config
38
47
 
39
48
  # Embedding model for semantic similarity matching
40
- # Options: "bert" (fast, 384-dim), "qwen3" (high quality, 1024-dim, 32K context), "gemma" (balanced, 768-dim, 8K context)
41
- # Default: "bert" (fastest, lowest memory)
42
- embedding_model: "bert"
43
-
44
- bert_model:
45
- model_id: models/mom-embedding-light
46
- threshold: 0.6
47
- use_cpu: true
49
+ # If not specified, automatically uses the model configured in embedding_models section
50
+ # Options: "mmbert" (multilingual, 768-dim), "qwen3" (high quality, 1024-dim, 32K context), "gemma" (balanced, 768-dim, 8K context)
51
+ # embedding_model: "mmbert" # Optional: explicitly set if you want to override auto-detection
48
52
 
49
53
  tools:
50
54
  enabled: true
@@ -125,20 +129,29 @@ feedback_detector:
125
129
  # access_key: "" # Optional: for Authorization header (Bearer token)
126
130
 
127
131
  # Embedding Models Configuration
128
- # These models provide intelligent embedding generation with automatic routing:
129
- # - Qwen3-Embedding-0.6B: Up to 32K context, high quality,
130
- # - EmbeddingGemma-300M: Up to 8K context, fast inference, Matryoshka support (768/512/256/128)
132
+ # This is the UNIFIED configuration for all embedding-related features:
133
+ # - Semantic Cache: Automatically uses the configured model
134
+ # - Tool Selection: Uses the configured model for tool matching
135
+ # - Embedding Signal: Uses the model specified in hnsw_config.model_type
136
+ # - Complexity Signal: Uses the model specified in hnsw_config.model_type
137
+ #
138
+ # Available models:
139
+ # - Qwen3-Embedding-0.6B (Pro): Up to 32K context, high quality, 1024-dim
140
+ # - EmbeddingGemma-300M (Flash): Up to 8K context, fast inference, Matryoshka support (768/512/256/128)
141
+ # - mmBERT-Embed-32K-2D-Matryoshka (Ultra): Up to 32K context, 1800+ languages, 2D Matryoshka (layer early exit + dimension reduction)
131
142
  embedding_models:
132
- qwen3_model_path: "models/mom-embedding-pro"
143
+ # qwen3_model_path: "models/mom-embedding-pro"
133
144
  # gemma_model_path: "models/mom-embedding-flash"
145
+ mmbert_model_path: "models/mom-embedding-ultra"
134
146
  use_cpu: true # Set to false for GPU acceleration (requires CUDA)
135
147
  # HNSW Configuration
136
148
  # Improves performance by preloading candidate embeddings at startup
137
149
  # and using HNSW index for O(log n) similarity search
138
150
  hnsw_config:
139
- model_type: "qwen3" # Which model to use: "qwen3" (high quality) or "gemma" (fast)
151
+ model_type: "mmbert" # Which model to use: "qwen3" (high quality), "gemma" (fast), or "mmbert" (multilingual)
140
152
  preload_embeddings: true # Precompute candidate embeddings at startup
141
- target_dimension: 1024 # Embedding dimension
153
+ target_dimension: 768 # Embedding dimension (1024 for qwen3, 768 for gemma/mmbert)
154
+ # For mmbert only: target_layer (3/6/11/22) for layer early exit
142
155
  enable_soft_matching: true
143
156
  min_score_threshold: 0.5
144
157
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "vllm-sr"
7
- version = "0.1.0.beta.2.dev20260126190945"
7
+ version = "0.1.0.beta.2.dev20260202073049"
8
8
  description = "vLLM Semantic Router - Intelligent routing for Mixture-of-Models"
9
9
  authors = [{name = "vLLM-SR Team"}]
10
10
  readme = "README.md"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: vllm-sr
3
- Version: 0.1.0b2.dev20260126190945
3
+ Version: 0.1.0b2.dev20260202073049
4
4
  Summary: vLLM Semantic Router - Intelligent routing for Mixture-of-Models
5
5
  Author: vLLM-SR Team
6
6
  License: Apache-2.0