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 +1 -1
- package/docs/ROUTER_GUIDE.md +7 -2
- package/package.json +1 -1
- package/router.js +4 -2
package/config.yaml
CHANGED
|
@@ -141,7 +141,7 @@ guardrails:
|
|
|
141
141
|
|
|
142
142
|
# Router configuration
|
|
143
143
|
router_settings:
|
|
144
|
-
routing_strategy:
|
|
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:
|
package/docs/ROUTER_GUIDE.md
CHANGED
|
@@ -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
|
|
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
|
-
//
|
|
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
package/router.js
CHANGED
|
@@ -84,8 +84,10 @@ class Router {
|
|
|
84
84
|
|
|
85
85
|
case 'default':
|
|
86
86
|
default:
|
|
87
|
-
// Use
|
|
88
|
-
|
|
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
|
|