@apinggithub/mydsh-auto-model-router 0.2.2 → 0.2.3
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.mjs +9 -5
- package/index.mjs +4 -3
- package/package.json +1 -1
package/config.mjs
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
// fallbackChain: [route, ...] (model-level, appended with the default)
|
|
23
23
|
// maxRetries: per-route retry budget on request-error
|
|
24
24
|
|
|
25
|
-
export const PLUGIN_VERSION = '0.2.
|
|
25
|
+
export const PLUGIN_VERSION = '0.2.3'
|
|
26
26
|
|
|
27
27
|
export const LEVEL_IDS = Object.freeze(['L0', 'L1', 'L2', 'L3'])
|
|
28
28
|
export const COST_MODES = Object.freeze(['cost-first', 'quality-first', 'balanced'])
|
|
@@ -297,9 +297,13 @@ function normalizeLevels(levels) {
|
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
function normalizeLevelRoute(route, where) {
|
|
300
|
+
// `reasoningEffort: null` means "this route has no thinking mode at all":
|
|
301
|
+
// the field is omitted so a provider whose model declares no reasoning
|
|
302
|
+
// metadata (Zhipu/Bailian flash models) is not rejected with
|
|
303
|
+
// UNSUPPORTED_REASONING_EFFORT.
|
|
304
|
+
const omitEffort = route.reasoningEffort === null
|
|
300
305
|
const normalized = normalizeRoute(route, where)
|
|
301
|
-
//
|
|
302
|
-
// thinking mode) so every level spells out its thinking intensity.
|
|
306
|
+
// Every other level carries an explicit effort; absent → 'off' (no thinking).
|
|
303
307
|
const contextWindow = route.contextWindow === undefined || route.contextWindow === null
|
|
304
308
|
? undefined
|
|
305
309
|
: Number(route.contextWindow)
|
|
@@ -308,7 +312,7 @@ function normalizeLevelRoute(route, where) {
|
|
|
308
312
|
}
|
|
309
313
|
return {
|
|
310
314
|
...normalized,
|
|
311
|
-
reasoningEffort: normalized.reasoningEffort ?? 'off',
|
|
315
|
+
...omitEffort ? {} : { reasoningEffort: normalized.reasoningEffort ?? 'off' },
|
|
312
316
|
// A level may declare that its route is a free-quota route. The flag rides
|
|
313
317
|
// along with the route so the router can prefer/demote it.
|
|
314
318
|
...route.freeQuota === true ? { freeQuota: true } : {},
|
|
@@ -328,7 +332,7 @@ function normalizeRoute(route, where) {
|
|
|
328
332
|
`mydsh-auto-model-router: "${where}" needs both provider and model, got ${JSON.stringify(route)}`,
|
|
329
333
|
)
|
|
330
334
|
}
|
|
331
|
-
const reasoningEffort = route.reasoningEffort === undefined
|
|
335
|
+
const reasoningEffort = route.reasoningEffort === undefined || route.reasoningEffort === null
|
|
332
336
|
? undefined
|
|
333
337
|
: String(route.reasoningEffort).trim() || undefined
|
|
334
338
|
return {
|
package/index.mjs
CHANGED
|
@@ -341,9 +341,10 @@ export function apply(ctx, input = {}) {
|
|
|
341
341
|
...proposed,
|
|
342
342
|
provider: route.provider,
|
|
343
343
|
model: route.model,
|
|
344
|
-
//
|
|
345
|
-
//
|
|
346
|
-
|
|
344
|
+
// A level that omits `reasoningEffort` (configured as `null`) has no
|
|
345
|
+
// thinking mode: sending an effort to a model without reasoning
|
|
346
|
+
// metadata would be rejected with UNSUPPORTED_REASONING_EFFORT.
|
|
347
|
+
...route.reasoningEffort === undefined ? {} : { reasoningEffort: route.reasoningEffort },
|
|
347
348
|
}
|
|
348
349
|
} catch (error) {
|
|
349
350
|
// The router must never be able to fail a user request: hand the host's
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@apinggithub/mydsh-auto-model-router",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Hybrid model router for DeepSeek Harness: declarative rules, user-configurable cost control (cost-first / quality-first / balanced), optional LLM task classifier, and failure fallback chains.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.mjs",
|