@oh-my-pi/pi-ai 8.2.0 → 8.2.1
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-ai",
|
|
3
|
-
"version": "8.2.
|
|
3
|
+
"version": "8.2.1",
|
|
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.1",
|
|
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",
|
|
@@ -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
|
}
|