@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
@@ -363,12 +363,12 @@ const formatResponseOpenAI = (response) => {
363
363
  type: "text",
364
364
  text: String(item.content)
365
365
  });
366
- } else if (item.type === "function_call") content.push({
366
+ } else if (item.type === "function_call" || item.type === "custom_tool_call") content.push({
367
367
  type: "function",
368
368
  id: item.call_id || item.id || "",
369
369
  function: {
370
370
  name: item.name,
371
- arguments: item.arguments || {}
371
+ arguments: item.type === "custom_tool_call" ? item.input : item.arguments || {}
372
372
  }
373
373
  });
374
374
  else if (item.type === "image_generation_call" && item.result) content.push({
@@ -552,7 +552,7 @@ function formatOpenAIResponsesInput(input, instructions) {
552
552
  }
553
553
  //#endregion
554
554
  //#region package.json
555
- var version = "8.19.1";
555
+ var version = "8.19.3";
556
556
  //#endregion
557
557
  //#region src/serializeError.ts
558
558
  const DEFAULT_MAX_DEPTH = 3;
@@ -1314,8 +1314,10 @@ var OpenAIChatStreamAccumulator = class {
1314
1314
  arguments: ""
1315
1315
  };
1316
1316
  if (toolCall.id) current.id = toolCall.id;
1317
- if (toolCall.function?.name) current.name = toolCall.function.name;
1318
- if (toolCall.function?.arguments) current.arguments += toolCall.function.arguments;
1317
+ const name = toolCall.function?.name ?? toolCall.custom?.name;
1318
+ const argumentsDelta = toolCall.function?.arguments ?? toolCall.custom?.input;
1319
+ if (name) current.name = name;
1320
+ if (argumentsDelta) current.arguments += argumentsDelta;
1319
1321
  this.toolCalls.set(key, current);
1320
1322
  this.lastToolCallKey = key;
1321
1323
  }
@@ -1332,14 +1334,15 @@ var OpenAIChatStreamAccumulator = class {
1332
1334
  }
1333
1335
  /**
1334
1336
  * Some OpenAI-compatible providers stream tool calls without an `index`. Match those deltas by a known
1335
- * `id`; a new `id` or a function name opens a new call, and anything else continues the latest call.
1337
+ * `id`; a new `id`, a function name, or a custom tool name opens a new call, and anything else continues
1338
+ * the latest call.
1336
1339
  */
1337
1340
  toolCallKey(toolCall) {
1338
1341
  if (toolCall.index !== void 0) return toolCall.index;
1339
1342
  if (toolCall.id) {
1340
1343
  for (const [key, existing] of this.toolCalls) if (existing.id === toolCall.id) return key;
1341
1344
  }
1342
- if (toolCall.id || toolCall.function?.name || this.lastToolCallKey === void 0) return `no-index-${this.toolCalls.size}`;
1345
+ if (toolCall.id || toolCall.function?.name || toolCall.custom?.name || this.lastToolCallKey === void 0) return `no-index-${this.toolCalls.size}`;
1343
1346
  return this.lastToolCallKey;
1344
1347
  }
1345
1348
  result() {