@posthog/ai 8.19.1 → 8.19.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/dist/adk/index.cjs +1 -1
- package/dist/adk/index.cjs.map +1 -1
- package/dist/adk/index.mjs +1 -1
- package/dist/adk/index.mjs.map +1 -1
- package/dist/anthropic/index.cjs +1 -1
- package/dist/anthropic/index.cjs.map +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/anthropic/index.mjs.map +1 -1
- package/dist/claude-agent-sdk/index.cjs +1 -1
- package/dist/claude-agent-sdk/index.cjs.map +1 -1
- package/dist/claude-agent-sdk/index.mjs +1 -1
- package/dist/claude-agent-sdk/index.mjs.map +1 -1
- package/dist/gemini/index.cjs +1 -1
- package/dist/gemini/index.cjs.map +1 -1
- package/dist/gemini/index.mjs +1 -1
- package/dist/gemini/index.mjs.map +1 -1
- package/dist/genkit/index.cjs +1 -1
- package/dist/genkit/index.cjs.map +1 -1
- package/dist/genkit/index.mjs +1 -1
- package/dist/genkit/index.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/langchain/index.cjs +1 -1
- package/dist/langchain/index.cjs.map +1 -1
- package/dist/langchain/index.mjs +1 -1
- package/dist/langchain/index.mjs.map +1 -1
- package/dist/langchain/middleware/index.cjs +1 -1
- package/dist/langchain/middleware/index.cjs.map +1 -1
- package/dist/langchain/middleware/index.mjs +1 -1
- package/dist/langchain/middleware/index.mjs.map +1 -1
- package/dist/openai/index.cjs +10 -7
- package/dist/openai/index.cjs.map +1 -1
- package/dist/openai/index.mjs +10 -7
- package/dist/openai/index.mjs.map +1 -1
- package/dist/openai-agents/index.cjs +3 -1
- package/dist/openai-agents/index.cjs.map +1 -1
- package/dist/openai-agents/index.mjs +3 -1
- package/dist/openai-agents/index.mjs.map +1 -1
- package/dist/vercel/index.cjs +1 -1
- package/dist/vercel/index.cjs.map +1 -1
- package/dist/vercel/index.mjs +1 -1
- package/dist/vercel/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/openai/index.cjs
CHANGED
|
@@ -367,12 +367,12 @@ const formatResponseOpenAI = (response) => {
|
|
|
367
367
|
type: "text",
|
|
368
368
|
text: String(item.content)
|
|
369
369
|
});
|
|
370
|
-
} else if (item.type === "function_call") content.push({
|
|
370
|
+
} else if (item.type === "function_call" || item.type === "custom_tool_call") content.push({
|
|
371
371
|
type: "function",
|
|
372
372
|
id: item.call_id || item.id || "",
|
|
373
373
|
function: {
|
|
374
374
|
name: item.name,
|
|
375
|
-
arguments: item.arguments || {}
|
|
375
|
+
arguments: item.type === "custom_tool_call" ? item.input : item.arguments || {}
|
|
376
376
|
}
|
|
377
377
|
});
|
|
378
378
|
else if (item.type === "image_generation_call" && item.result) content.push({
|
|
@@ -556,7 +556,7 @@ function formatOpenAIResponsesInput(input, instructions) {
|
|
|
556
556
|
}
|
|
557
557
|
//#endregion
|
|
558
558
|
//#region package.json
|
|
559
|
-
var version = "8.19.
|
|
559
|
+
var version = "8.19.3";
|
|
560
560
|
//#endregion
|
|
561
561
|
//#region src/serializeError.ts
|
|
562
562
|
const DEFAULT_MAX_DEPTH = 3;
|
|
@@ -1318,8 +1318,10 @@ var OpenAIChatStreamAccumulator = class {
|
|
|
1318
1318
|
arguments: ""
|
|
1319
1319
|
};
|
|
1320
1320
|
if (toolCall.id) current.id = toolCall.id;
|
|
1321
|
-
|
|
1322
|
-
|
|
1321
|
+
const name = toolCall.function?.name ?? toolCall.custom?.name;
|
|
1322
|
+
const argumentsDelta = toolCall.function?.arguments ?? toolCall.custom?.input;
|
|
1323
|
+
if (name) current.name = name;
|
|
1324
|
+
if (argumentsDelta) current.arguments += argumentsDelta;
|
|
1323
1325
|
this.toolCalls.set(key, current);
|
|
1324
1326
|
this.lastToolCallKey = key;
|
|
1325
1327
|
}
|
|
@@ -1336,14 +1338,15 @@ var OpenAIChatStreamAccumulator = class {
|
|
|
1336
1338
|
}
|
|
1337
1339
|
/**
|
|
1338
1340
|
* Some OpenAI-compatible providers stream tool calls without an `index`. Match those deltas by a known
|
|
1339
|
-
* `id`; a new `id
|
|
1341
|
+
* `id`; a new `id`, a function name, or a custom tool name opens a new call, and anything else continues
|
|
1342
|
+
* the latest call.
|
|
1340
1343
|
*/
|
|
1341
1344
|
toolCallKey(toolCall) {
|
|
1342
1345
|
if (toolCall.index !== void 0) return toolCall.index;
|
|
1343
1346
|
if (toolCall.id) {
|
|
1344
1347
|
for (const [key, existing] of this.toolCalls) if (existing.id === toolCall.id) return key;
|
|
1345
1348
|
}
|
|
1346
|
-
if (toolCall.id || toolCall.function?.name || this.lastToolCallKey === void 0) return `no-index-${this.toolCalls.size}`;
|
|
1349
|
+
if (toolCall.id || toolCall.function?.name || toolCall.custom?.name || this.lastToolCallKey === void 0) return `no-index-${this.toolCalls.size}`;
|
|
1347
1350
|
return this.lastToolCallKey;
|
|
1348
1351
|
}
|
|
1349
1352
|
result() {
|