@f5-sales-demo/pi-ai 19.102.2 → 19.102.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/package.json +2 -2
- package/src/model-thinking.ts +46 -7
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/pi-ai",
|
|
4
|
-
"version": "19.102.
|
|
4
|
+
"version": "19.102.4",
|
|
5
5
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
6
6
|
"homepage": "https://github.com/f5-sales-demo/xcsh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@aws-sdk/client-bedrock-runtime": "^3",
|
|
46
46
|
"@bufbuild/protobuf": "^2.11",
|
|
47
47
|
"@google/genai": "^2.13",
|
|
48
|
-
"@f5-sales-demo/pi-utils": "19.102.
|
|
48
|
+
"@f5-sales-demo/pi-utils": "19.102.4",
|
|
49
49
|
"@sinclair/typebox": "^0.34",
|
|
50
50
|
"@smithy/node-http-handler": "^4.4",
|
|
51
51
|
"ajv": "^8.20",
|
package/src/model-thinking.ts
CHANGED
|
@@ -68,6 +68,18 @@ const ANTHROPIC_ADAPTIVE_EFFORTS: readonly Effort[] = [
|
|
|
68
68
|
Effort.XHigh,
|
|
69
69
|
Effort.Max,
|
|
70
70
|
];
|
|
71
|
+
/**
|
|
72
|
+
* Anthropic Messages API versions MEASURED to accept the full adaptive enum
|
|
73
|
+
* (`xhigh` and `max`) with no fallback chain to be capped against.
|
|
74
|
+
*
|
|
75
|
+
* Probed 2026-07-30 against the live gateway with a bogus control value, which
|
|
76
|
+
* was rejected everywhere — so the accepts mean something (#2630).
|
|
77
|
+
*
|
|
78
|
+
* Adding a version here without a probe is the defect this set exists to
|
|
79
|
+
* prevent: an unprobed model must fail closed to DEFAULT_REASONING_EFFORTS.
|
|
80
|
+
*/
|
|
81
|
+
const ANTHROPIC_EXTENDED_EFFORT_VERSIONS: ReadonlySet<string> = new Set(["5.0"]);
|
|
82
|
+
|
|
71
83
|
const GEMINI_3_PRO_EFFORTS: readonly Effort[] = [Effort.Low, Effort.High];
|
|
72
84
|
const GEMINI_3_FLASH_EFFORTS: readonly Effort[] = [Effort.Minimal, Effort.Low, Effort.Medium, Effort.High];
|
|
73
85
|
const GPT_5_2_PLUS_EFFORTS: readonly Effort[] = [Effort.Low, Effort.Medium, Effort.High, Effort.XHigh];
|
|
@@ -449,15 +461,42 @@ function inferAnthropicSupportedEfforts<TApi extends Api>(
|
|
|
449
461
|
(model.api === "anthropic-messages" || model.api === "bedrock-converse-stream") &&
|
|
450
462
|
semverGte(parsedModel.version, "4.6")
|
|
451
463
|
) {
|
|
452
|
-
//
|
|
453
|
-
//
|
|
464
|
+
// Only 5.x accepts the extended range. Probed against the live gateway on
|
|
465
|
+
// 2026-07-30 with a bogus control value (rejected everywhere, so the accepts
|
|
466
|
+
// mean something) — #2630:
|
|
467
|
+
//
|
|
468
|
+
// model low med high xhigh max fallbacks
|
|
469
|
+
// claude-opus-5 Y Y Y Y Y (none)
|
|
470
|
+
// claude-sonnet-5 Y Y Y Y Y (none)
|
|
471
|
+
// claude-opus-4-8 Y Y Y Y Y opus-4-6, opus-4-5
|
|
472
|
+
// claude-opus-4-6 Y Y Y . Y opus-4-5, sonnet-4-6
|
|
473
|
+
// claude-sonnet-4-6 Y Y Y . Y (none)
|
|
474
|
+
// claude-opus-4-5 Y Y Y . . (none)
|
|
475
|
+
//
|
|
476
|
+
// The ceiling is what a model group AND its fallbacks accept, because the
|
|
477
|
+
// gateway re-sends an identical body on fallback instead of re-mapping per
|
|
478
|
+
// target — in #2630 both fallbacks 400'd on the same `xhigh`.
|
|
479
|
+
// `claude-opus-4-5` accepts neither `xhigh` nor `max` and sits in both 4.x
|
|
480
|
+
// chains, so 4.6 and 4.8 cap at `high` even though 4.8 accepts `xhigh`
|
|
481
|
+
// alone. 5.x has no fallback chain, so it keeps its full range.
|
|
482
|
+
//
|
|
483
|
+
// #2346 keyed this on `kind === "opus" || version >= 5.0` after probing only
|
|
484
|
+
// opus-5 and sonnet-5, which handed `xhigh` to every opus >= 4.6 and made
|
|
485
|
+
// resumed sessions pinned to opus-4-6 fail with a 400.
|
|
454
486
|
const extended = parsedModel.kind === "opus" || semverGte(parsedModel.version, "5.0");
|
|
455
487
|
if (!extended) return DEFAULT_REASONING_EFFORTS;
|
|
456
|
-
//
|
|
457
|
-
//
|
|
458
|
-
//
|
|
459
|
-
|
|
460
|
-
|
|
488
|
+
// Bedrock was NOT probed, so it keeps its pre-existing `xhigh` ceiling.
|
|
489
|
+
// Narrowing it here would repeat #2346's mistake in the opposite direction —
|
|
490
|
+
// changing a whole family's capability without measuring it.
|
|
491
|
+
if (model.api === "bedrock-converse-stream") return DEFAULT_REASONING_EFFORTS_WITH_XHIGH;
|
|
492
|
+
// Messages API: opt in per MEASURED version, never by an open-ended
|
|
493
|
+
// comparison. `semverGte(version, "5.0")` would hand the extended enum to
|
|
494
|
+
// every future Claude the moment it lands in the catalog — the same
|
|
495
|
+
// open-ended grant that caused this bug. Unprobed versions fail closed to
|
|
496
|
+
// the conservative range; add one here only with a probe to back it.
|
|
497
|
+
return ANTHROPIC_EXTENDED_EFFORT_VERSIONS.has(`${parsedModel.version.major}.${parsedModel.version.minor}`)
|
|
498
|
+
? ANTHROPIC_ADAPTIVE_EFFORTS
|
|
499
|
+
: DEFAULT_REASONING_EFFORTS;
|
|
461
500
|
}
|
|
462
501
|
return inferFallbackEfforts(model);
|
|
463
502
|
}
|