@f5-sales-demo/pi-ai 23.10.12 → 23.10.16
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@f5-sales-demo/pi-ai",
|
|
4
|
-
"version": "23.10.
|
|
4
|
+
"version": "23.10.16",
|
|
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",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"scripts": {
|
|
35
35
|
"precheck": "bun ../../scripts/check-installed-dependencies.ts",
|
|
36
36
|
"check": "biome check . && bun run check:types",
|
|
37
|
-
"check:types": "
|
|
37
|
+
"check:types": "tsc -p tsconfig.json --noEmit",
|
|
38
38
|
"lint": "biome lint .",
|
|
39
39
|
"pretest": "bun ../../scripts/check-installed-dependencies.ts",
|
|
40
40
|
"test": "bun test",
|
|
@@ -43,19 +43,19 @@
|
|
|
43
43
|
"generate-models": "bun scripts/generate-models.ts"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@anthropic-ai/sdk": "
|
|
47
|
-
"@aws-sdk/client-bedrock-runtime": "3.
|
|
48
|
-
"@bufbuild/protobuf": "2.
|
|
49
|
-
"@f5-sales-demo/pi-utils": "23.10.
|
|
50
|
-
"@google/genai": "
|
|
46
|
+
"@anthropic-ai/sdk": "1.8.0",
|
|
47
|
+
"@aws-sdk/client-bedrock-runtime": "3.1168.0",
|
|
48
|
+
"@bufbuild/protobuf": "2.17.0",
|
|
49
|
+
"@f5-sales-demo/pi-utils": "23.10.16",
|
|
50
|
+
"@google/genai": "3.3.0",
|
|
51
51
|
"@sinclair/typebox": "0.34.52",
|
|
52
|
-
"@smithy/node-http-handler": "4.
|
|
53
|
-
"ajv": "
|
|
54
|
-
"ajv-formats": "
|
|
55
|
-
"google-auth-library": "
|
|
56
|
-
"openai": "7.
|
|
57
|
-
"partial-json": "
|
|
58
|
-
"zod": "4.
|
|
52
|
+
"@smithy/node-http-handler": "4.14.2",
|
|
53
|
+
"ajv": "8.20.0",
|
|
54
|
+
"ajv-formats": "3.0.1",
|
|
55
|
+
"google-auth-library": "11.3.4",
|
|
56
|
+
"openai": "7.56.0",
|
|
57
|
+
"partial-json": "0.1.7",
|
|
58
|
+
"zod": "4.6.7"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/bun": "1.4.4"
|
|
@@ -172,10 +172,6 @@ export function buildAnthropicHeaders(options: AnthropicHeaderOptions): Record<s
|
|
|
172
172
|
|
|
173
173
|
type AnthropicCacheControl = { type: "ephemeral"; ttl?: "1h" | "5m" };
|
|
174
174
|
|
|
175
|
-
type AnthropicSamplingParams = MessageCreateParamsStreaming & {
|
|
176
|
-
top_p?: number;
|
|
177
|
-
top_k?: number;
|
|
178
|
-
};
|
|
179
175
|
function getCacheControl(
|
|
180
176
|
baseUrl: string,
|
|
181
177
|
cacheRetention?: CacheRetention,
|
|
@@ -192,7 +188,7 @@ function getCacheControl(
|
|
|
192
188
|
}
|
|
193
189
|
|
|
194
190
|
// Stealth mode: Mimic Claude Code headers and tool prefixing.
|
|
195
|
-
export const claudeCodeVersion = "2.1.
|
|
191
|
+
export const claudeCodeVersion = "2.1.330";
|
|
196
192
|
export const claudeToolPrefix: string = "proxy_";
|
|
197
193
|
export const claudeCodeSystemInstruction = "You are a Claude agent, built on Anthropic's Claude Agent SDK.";
|
|
198
194
|
|
|
@@ -1631,7 +1627,7 @@ function buildParams(
|
|
|
1631
1627
|
(typeof requestedToolChoice === "object" && requestedToolChoice.type === "tool"))
|
|
1632
1628
|
? "auto"
|
|
1633
1629
|
: requestedToolChoice;
|
|
1634
|
-
const params:
|
|
1630
|
+
const params: MessageCreateParamsStreaming = {
|
|
1635
1631
|
model: model.id,
|
|
1636
1632
|
messages: convertAnthropicMessages(
|
|
1637
1633
|
context.messages,
|
|
@@ -1642,16 +1638,6 @@ function buildParams(
|
|
|
1642
1638
|
stream: true,
|
|
1643
1639
|
};
|
|
1644
1640
|
|
|
1645
|
-
if (!alwaysThinking && options?.temperature !== undefined) {
|
|
1646
|
-
params.temperature = options.temperature;
|
|
1647
|
-
}
|
|
1648
|
-
if (options?.topP !== undefined) {
|
|
1649
|
-
params.top_p = options.topP;
|
|
1650
|
-
}
|
|
1651
|
-
if (options?.topK !== undefined) {
|
|
1652
|
-
params.top_k = options.topK;
|
|
1653
|
-
}
|
|
1654
|
-
|
|
1655
1641
|
if (context.tools) {
|
|
1656
1642
|
const forcedToolName =
|
|
1657
1643
|
model.provider === "anthropic" &&
|
|
@@ -1699,9 +1685,6 @@ function buildParams(
|
|
|
1699
1685
|
params.output_config = { effort };
|
|
1700
1686
|
}
|
|
1701
1687
|
}
|
|
1702
|
-
// Anthropic requires temperature=1 when thinking is enabled; override any
|
|
1703
|
-
// caller-supplied value (e.g. temperature=0 set for deterministic non-interactive mode).
|
|
1704
|
-
if (!alwaysThinking) params.temperature = 1;
|
|
1705
1688
|
}
|
|
1706
1689
|
|
|
1707
1690
|
const metadataUserId = resolveAnthropicMetadataUserId(options?.metadata?.user_id, isOAuthToken);
|
|
@@ -79,7 +79,7 @@ export function resolveAntigravityServingModelId(requestedModelId: string): stri
|
|
|
79
79
|
* GeminiCLI/VERSION/MODEL (PLATFORM; ARCH; SURFACE)
|
|
80
80
|
*/
|
|
81
81
|
export function getGeminiCliUserAgent(modelId = "gemini-3.1-pro-preview"): string {
|
|
82
|
-
const version = process.env.PI_AI_GEMINI_CLI_VERSION || "0.
|
|
82
|
+
const version = process.env.PI_AI_GEMINI_CLI_VERSION || "0.70.0";
|
|
83
83
|
const platform = process.platform === "win32" ? "win32" : process.platform;
|
|
84
84
|
const arch = process.arch === "x64" ? "x64" : process.arch;
|
|
85
85
|
return `GeminiCLI/${version}/${modelId} (${platform}; ${arch}; terminal)`;
|
|
@@ -319,6 +319,7 @@ export function mapStopReason(reason: FinishReason): StopReason {
|
|
|
319
319
|
case FinishReason.STOP:
|
|
320
320
|
return "stop";
|
|
321
321
|
case FinishReason.MAX_TOKENS:
|
|
322
|
+
case FinishReason.CONTINUATION:
|
|
322
323
|
return "length";
|
|
323
324
|
case FinishReason.BLOCKLIST:
|
|
324
325
|
case FinishReason.PROHIBITED_CONTENT:
|
|
@@ -336,6 +337,11 @@ export function mapStopReason(reason: FinishReason): StopReason {
|
|
|
336
337
|
case FinishReason.UNEXPECTED_TOOL_CALL:
|
|
337
338
|
case FinishReason.NO_IMAGE:
|
|
338
339
|
case FinishReason.TOO_MANY_TOOL_CALLS:
|
|
340
|
+
case FinishReason.MISSING_THOUGHT_SIGNATURE:
|
|
341
|
+
case FinishReason.MALFORMED_RESPONSE:
|
|
342
|
+
case FinishReason.ESCALATION:
|
|
343
|
+
case FinishReason.PUP_LIMITED_DISABLED:
|
|
344
|
+
case FinishReason.MODEL_ARMOR:
|
|
339
345
|
return "error";
|
|
340
346
|
default: {
|
|
341
347
|
const _exhaustive: never = reason;
|
|
@@ -352,6 +358,7 @@ export function mapStopReasonString(reason: string): StopReason {
|
|
|
352
358
|
case "STOP":
|
|
353
359
|
return "stop";
|
|
354
360
|
case "MAX_TOKENS":
|
|
361
|
+
case "CONTINUATION":
|
|
355
362
|
return "length";
|
|
356
363
|
default:
|
|
357
364
|
return "error";
|