llmjs2 1.3.3 → 1.3.4

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.
package/config.yaml CHANGED
@@ -141,7 +141,7 @@ guardrails:
141
141
 
142
142
  # Router configuration
143
143
  router_settings:
144
- routing_strategy: random # Options: default, random, sequential
144
+ routing_strategy: default # Options: default (sequential), random, sequential
145
145
 
146
146
  # Optional: Custom server settings (can also be set via CLI or env vars)
147
147
  # server_settings:
@@ -133,12 +133,17 @@ Each model in the list is defined with:
133
133
 
134
134
  ### Default Strategy
135
135
 
136
- When no strategy is specified, uses load balancing across models with the same `model_name`.
136
+ When no strategy is specified, uses sequential selection across all available models for auto-routing (when no specific model is requested).
137
137
 
138
138
  ```javascript
139
139
  const route = router(modelList); // or router(modelList, 'default')
140
140
 
141
- // Routes to one of the models with model_name="gpt-3.5-turbo"
141
+ // Auto-route with sequential selection (cycles through all models)
142
+ const response = await route.completion({
143
+ messages: [...]
144
+ });
145
+
146
+ // Routes to one of the models with model_name="gpt-3.5-turbo" (load balancing)
142
147
  const response = await route.completion({
143
148
  model: "gpt-3.5-turbo",
144
149
  messages: [...]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "llmjs2",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "A unified Node.js library for connecting to multiple LLM providers: OpenAI, Ollama, and OpenRouter",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
package/router.js CHANGED
@@ -84,8 +84,10 @@ class Router {
84
84
 
85
85
  case 'default':
86
86
  default:
87
- // Use first available model
88
- return allModels[0];
87
+ // Use sequential selection for auto-routing
88
+ const selectedModel = allModels[this.sequentialIndex];
89
+ this.sequentialIndex = (this.sequentialIndex + 1) % allModels.length;
90
+ return selectedModel;
89
91
  }
90
92
  }
91
93