@oh-my-pi/pi-ai 8.2.0 → 8.2.2
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/models.generated.ts +42 -24
- package/src/providers/openai-responses.ts +13 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-ai",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.2",
|
|
4
4
|
"description": "Unified LLM API with automatic model discovery and provider configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"test": "bun test"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@oh-my-pi/pi-utils": "8.2.
|
|
59
|
+
"@oh-my-pi/pi-utils": "8.2.2",
|
|
60
60
|
"@anthropic-ai/sdk": "^0.71.2",
|
|
61
61
|
"@aws-sdk/client-bedrock-runtime": "^3.975.0",
|
|
62
62
|
"@bufbuild/protobuf": "^2.10.2",
|
package/src/models.generated.ts
CHANGED
|
@@ -4614,7 +4614,7 @@ export const MODELS = {
|
|
|
4614
4614
|
input: ["text"],
|
|
4615
4615
|
cost: {
|
|
4616
4616
|
input: 0.09,
|
|
4617
|
-
output: 0.
|
|
4617
|
+
output: 0.39999999999999997,
|
|
4618
4618
|
cacheRead: 0,
|
|
4619
4619
|
cacheWrite: 0,
|
|
4620
4620
|
},
|
|
@@ -5296,7 +5296,7 @@ export const MODELS = {
|
|
|
5296
5296
|
input: 0.09999999999999999,
|
|
5297
5297
|
output: 0.39999999999999997,
|
|
5298
5298
|
cacheRead: 0.024999999999999998,
|
|
5299
|
-
cacheWrite: 0.
|
|
5299
|
+
cacheWrite: 0.08333333333333334,
|
|
5300
5300
|
},
|
|
5301
5301
|
contextWindow: 1048576,
|
|
5302
5302
|
maxTokens: 8192,
|
|
@@ -5313,7 +5313,7 @@ export const MODELS = {
|
|
|
5313
5313
|
input: 0.09999999999999999,
|
|
5314
5314
|
output: 0.39999999999999997,
|
|
5315
5315
|
cacheRead: 0.024999999999999998,
|
|
5316
|
-
cacheWrite: 0.
|
|
5316
|
+
cacheWrite: 0.08333333333333334,
|
|
5317
5317
|
},
|
|
5318
5318
|
contextWindow: 1048576,
|
|
5319
5319
|
maxTokens: 8192,
|
|
@@ -5347,7 +5347,7 @@ export const MODELS = {
|
|
|
5347
5347
|
input: 0.3,
|
|
5348
5348
|
output: 2.5,
|
|
5349
5349
|
cacheRead: 0.03,
|
|
5350
|
-
cacheWrite: 0.
|
|
5350
|
+
cacheWrite: 0.08333333333333334,
|
|
5351
5351
|
},
|
|
5352
5352
|
contextWindow: 1048576,
|
|
5353
5353
|
maxTokens: 65535,
|
|
@@ -5364,7 +5364,7 @@ export const MODELS = {
|
|
|
5364
5364
|
input: 0.09999999999999999,
|
|
5365
5365
|
output: 0.39999999999999997,
|
|
5366
5366
|
cacheRead: 0.01,
|
|
5367
|
-
cacheWrite: 0.
|
|
5367
|
+
cacheWrite: 0.08333333333333334,
|
|
5368
5368
|
},
|
|
5369
5369
|
contextWindow: 1048576,
|
|
5370
5370
|
maxTokens: 65535,
|
|
@@ -5381,7 +5381,7 @@ export const MODELS = {
|
|
|
5381
5381
|
input: 0.09999999999999999,
|
|
5382
5382
|
output: 0.39999999999999997,
|
|
5383
5383
|
cacheRead: 0.01,
|
|
5384
|
-
cacheWrite: 0.
|
|
5384
|
+
cacheWrite: 0.08333333333333334,
|
|
5385
5385
|
},
|
|
5386
5386
|
contextWindow: 1048576,
|
|
5387
5387
|
maxTokens: 65535,
|
|
@@ -5398,7 +5398,7 @@ export const MODELS = {
|
|
|
5398
5398
|
input: 0.3,
|
|
5399
5399
|
output: 2.5,
|
|
5400
5400
|
cacheRead: 0.03,
|
|
5401
|
-
cacheWrite: 0.
|
|
5401
|
+
cacheWrite: 0.08333333333333334,
|
|
5402
5402
|
},
|
|
5403
5403
|
contextWindow: 1048576,
|
|
5404
5404
|
maxTokens: 65535,
|
|
@@ -5466,7 +5466,7 @@ export const MODELS = {
|
|
|
5466
5466
|
input: 0.5,
|
|
5467
5467
|
output: 3,
|
|
5468
5468
|
cacheRead: 0.049999999999999996,
|
|
5469
|
-
cacheWrite: 0.
|
|
5469
|
+
cacheWrite: 0.08333333333333334,
|
|
5470
5470
|
},
|
|
5471
5471
|
contextWindow: 1048576,
|
|
5472
5472
|
maxTokens: 65535,
|
|
@@ -10927,9 +10927,9 @@ export const MODELS = {
|
|
|
10927
10927
|
reasoning: true,
|
|
10928
10928
|
input: ["text"],
|
|
10929
10929
|
cost: {
|
|
10930
|
-
input: 0
|
|
10931
|
-
output:
|
|
10932
|
-
cacheRead: 0
|
|
10930
|
+
input: 0,
|
|
10931
|
+
output: 0,
|
|
10932
|
+
cacheRead: 0,
|
|
10933
10933
|
cacheWrite: 0,
|
|
10934
10934
|
},
|
|
10935
10935
|
contextWindow: 131072,
|
|
@@ -10945,9 +10945,9 @@ export const MODELS = {
|
|
|
10945
10945
|
reasoning: true,
|
|
10946
10946
|
input: ["text"],
|
|
10947
10947
|
cost: {
|
|
10948
|
-
input: 0
|
|
10949
|
-
output:
|
|
10950
|
-
cacheRead: 0
|
|
10948
|
+
input: 0,
|
|
10949
|
+
output: 0,
|
|
10950
|
+
cacheRead: 0,
|
|
10951
10951
|
cacheWrite: 0,
|
|
10952
10952
|
},
|
|
10953
10953
|
contextWindow: 131072,
|
|
@@ -10981,8 +10981,8 @@ export const MODELS = {
|
|
|
10981
10981
|
reasoning: true,
|
|
10982
10982
|
input: ["text", "image"],
|
|
10983
10983
|
cost: {
|
|
10984
|
-
input: 0
|
|
10985
|
-
output:
|
|
10984
|
+
input: 0,
|
|
10985
|
+
output: 0,
|
|
10986
10986
|
cacheRead: 0,
|
|
10987
10987
|
cacheWrite: 0,
|
|
10988
10988
|
},
|
|
@@ -10999,9 +10999,9 @@ export const MODELS = {
|
|
|
10999
10999
|
reasoning: true,
|
|
11000
11000
|
input: ["text"],
|
|
11001
11001
|
cost: {
|
|
11002
|
-
input: 0
|
|
11003
|
-
output:
|
|
11004
|
-
cacheRead: 0
|
|
11002
|
+
input: 0,
|
|
11003
|
+
output: 0,
|
|
11004
|
+
cacheRead: 0,
|
|
11005
11005
|
cacheWrite: 0,
|
|
11006
11006
|
},
|
|
11007
11007
|
contextWindow: 204800,
|
|
@@ -11017,8 +11017,8 @@ export const MODELS = {
|
|
|
11017
11017
|
reasoning: true,
|
|
11018
11018
|
input: ["text", "image"],
|
|
11019
11019
|
cost: {
|
|
11020
|
-
input: 0
|
|
11021
|
-
output: 0
|
|
11020
|
+
input: 0,
|
|
11021
|
+
output: 0,
|
|
11022
11022
|
cacheRead: 0,
|
|
11023
11023
|
cacheWrite: 0,
|
|
11024
11024
|
},
|
|
@@ -11035,13 +11035,31 @@ export const MODELS = {
|
|
|
11035
11035
|
reasoning: true,
|
|
11036
11036
|
input: ["text"],
|
|
11037
11037
|
cost: {
|
|
11038
|
-
input: 0
|
|
11039
|
-
output:
|
|
11040
|
-
cacheRead: 0
|
|
11038
|
+
input: 0,
|
|
11039
|
+
output: 0,
|
|
11040
|
+
cacheRead: 0,
|
|
11041
11041
|
cacheWrite: 0,
|
|
11042
11042
|
},
|
|
11043
11043
|
contextWindow: 204800,
|
|
11044
11044
|
maxTokens: 131072,
|
|
11045
11045
|
} satisfies Model<"openai-completions">,
|
|
11046
|
+
"glm-4.7-flash": {
|
|
11047
|
+
id: "glm-4.7-flash",
|
|
11048
|
+
name: "GLM-4.7-Flash",
|
|
11049
|
+
api: "openai-completions",
|
|
11050
|
+
provider: "zai",
|
|
11051
|
+
baseUrl: "https://api.z.ai/api/coding/paas/v4",
|
|
11052
|
+
compat: {"supportsDeveloperRole":false,"thinkingFormat":"zai"},
|
|
11053
|
+
reasoning: true,
|
|
11054
|
+
input: ["text"],
|
|
11055
|
+
cost: {
|
|
11056
|
+
input: 0,
|
|
11057
|
+
output: 0,
|
|
11058
|
+
cacheRead: 0,
|
|
11059
|
+
cacheWrite: 0,
|
|
11060
|
+
},
|
|
11061
|
+
contextWindow: 200000,
|
|
11062
|
+
maxTokens: 131072,
|
|
11063
|
+
} satisfies Model<"openai-completions">,
|
|
11046
11064
|
},
|
|
11047
11065
|
} as const;
|
|
@@ -240,6 +240,13 @@ export const streamOpenAIResponses: StreamFunction<"openai-responses"> = (
|
|
|
240
240
|
});
|
|
241
241
|
}
|
|
242
242
|
}
|
|
243
|
+
// Handle function call arguments done (some providers send this instead of deltas)
|
|
244
|
+
else if (event.type === "response.function_call_arguments.done") {
|
|
245
|
+
if (currentItem?.type === "function_call" && currentBlock?.type === "toolCall") {
|
|
246
|
+
currentBlock.partialJson = event.arguments;
|
|
247
|
+
currentBlock.arguments = parseStreamingJson(currentBlock.partialJson);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
243
250
|
// Handle output item completion
|
|
244
251
|
else if (event.type === "response.output_item.done") {
|
|
245
252
|
const item = event.item;
|
|
@@ -265,13 +272,17 @@ export const streamOpenAIResponses: StreamFunction<"openai-responses"> = (
|
|
|
265
272
|
});
|
|
266
273
|
currentBlock = null;
|
|
267
274
|
} else if (item.type === "function_call") {
|
|
275
|
+
const args =
|
|
276
|
+
currentBlock?.type === "toolCall" && currentBlock.partialJson
|
|
277
|
+
? JSON.parse(currentBlock.partialJson)
|
|
278
|
+
: JSON.parse(item.arguments);
|
|
268
279
|
const toolCall: ToolCall = {
|
|
269
280
|
type: "toolCall",
|
|
270
281
|
id: `${item.call_id}|${item.id}`,
|
|
271
282
|
name: item.name,
|
|
272
|
-
arguments:
|
|
283
|
+
arguments: args,
|
|
273
284
|
};
|
|
274
|
-
|
|
285
|
+
currentBlock = null;
|
|
275
286
|
stream.push({ type: "toolcall_end", contentIndex: blockIndex(), toolCall, partial: output });
|
|
276
287
|
}
|
|
277
288
|
}
|