@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.
Files changed (45) hide show
  1. package/dist/adk/index.cjs +1 -1
  2. package/dist/adk/index.cjs.map +1 -1
  3. package/dist/adk/index.mjs +1 -1
  4. package/dist/adk/index.mjs.map +1 -1
  5. package/dist/anthropic/index.cjs +1 -1
  6. package/dist/anthropic/index.cjs.map +1 -1
  7. package/dist/anthropic/index.mjs +1 -1
  8. package/dist/anthropic/index.mjs.map +1 -1
  9. package/dist/claude-agent-sdk/index.cjs +1 -1
  10. package/dist/claude-agent-sdk/index.cjs.map +1 -1
  11. package/dist/claude-agent-sdk/index.mjs +1 -1
  12. package/dist/claude-agent-sdk/index.mjs.map +1 -1
  13. package/dist/gemini/index.cjs +1 -1
  14. package/dist/gemini/index.cjs.map +1 -1
  15. package/dist/gemini/index.mjs +1 -1
  16. package/dist/gemini/index.mjs.map +1 -1
  17. package/dist/genkit/index.cjs +1 -1
  18. package/dist/genkit/index.cjs.map +1 -1
  19. package/dist/genkit/index.mjs +1 -1
  20. package/dist/genkit/index.mjs.map +1 -1
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.mjs +1 -1
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/langchain/index.cjs +1 -1
  26. package/dist/langchain/index.cjs.map +1 -1
  27. package/dist/langchain/index.mjs +1 -1
  28. package/dist/langchain/index.mjs.map +1 -1
  29. package/dist/langchain/middleware/index.cjs +1 -1
  30. package/dist/langchain/middleware/index.cjs.map +1 -1
  31. package/dist/langchain/middleware/index.mjs +1 -1
  32. package/dist/langchain/middleware/index.mjs.map +1 -1
  33. package/dist/openai/index.cjs +10 -7
  34. package/dist/openai/index.cjs.map +1 -1
  35. package/dist/openai/index.mjs +10 -7
  36. package/dist/openai/index.mjs.map +1 -1
  37. package/dist/openai-agents/index.cjs +3 -1
  38. package/dist/openai-agents/index.cjs.map +1 -1
  39. package/dist/openai-agents/index.mjs +3 -1
  40. package/dist/openai-agents/index.mjs.map +1 -1
  41. package/dist/vercel/index.cjs +1 -1
  42. package/dist/vercel/index.cjs.map +1 -1
  43. package/dist/vercel/index.mjs +1 -1
  44. package/dist/vercel/index.mjs.map +1 -1
  45. package/package.json +4 -4
@@ -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.1";
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
- if (toolCall.function?.name) current.name = toolCall.function.name;
1322
- if (toolCall.function?.arguments) current.arguments += toolCall.function.arguments;
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` or a function name opens a new call, and anything else continues the latest call.
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() {