@ai-sdk/openai 3.0.138 → 3.0.140

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/index.mjs CHANGED
@@ -3670,7 +3670,7 @@ function getParallelToolCallMetadata({
3670
3670
  }) {
3671
3671
  var _a2;
3672
3672
  const metadata = (_a2 = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a2.parallelToolCall;
3673
- if (!isJSONObject(metadata) || typeof metadata.itemId !== "string" || typeof metadata.toolCallId !== "string" || typeof metadata.toolName !== "string" || typeof metadata.input !== "string" || typeof metadata.index !== "number" || !Number.isInteger(metadata.index) || typeof metadata.count !== "number" || !Number.isInteger(metadata.count) || metadata.index < 0 || metadata.count <= metadata.index) {
3673
+ if (!isJSONObject(metadata) || typeof metadata.itemId !== "string" || typeof metadata.toolCallId !== "string" || typeof metadata.toolName !== "string" || metadata.input !== void 0 && typeof metadata.input !== "string" || typeof metadata.index !== "number" || !Number.isInteger(metadata.index) || typeof metadata.count !== "number" || !Number.isInteger(metadata.count) || metadata.index < 0 || metadata.count <= metadata.index) {
3674
3674
  return void 0;
3675
3675
  }
3676
3676
  return metadata;
@@ -3724,7 +3724,7 @@ async function expandParallelToolCall({
3724
3724
  itemId,
3725
3725
  toolCallId: toolCall.toolCallId,
3726
3726
  toolName: toolCall.toolName,
3727
- input: toolCall.input,
3727
+ ...index === 0 && { input: toolCall.input },
3728
3728
  index,
3729
3729
  count: toolUses.length
3730
3730
  }
@@ -3911,7 +3911,7 @@ async function convertFunctionToolResultOutput({
3911
3911
  }
3912
3912
  }
3913
3913
  function hasSameParallelToolCall(first, second) {
3914
- return first.itemId === second.itemId && first.toolCallId === second.toolCallId && first.toolName === second.toolName && first.input === second.input && first.count === second.count;
3914
+ return first.itemId === second.itemId && first.toolCallId === second.toolCallId && first.toolName === second.toolName && (first.input === void 0 || second.input === void 0 || first.input === second.input) && first.count === second.count;
3915
3915
  }
3916
3916
  function collectCompleteParallelToolResultGroups({
3917
3917
  prompt,
@@ -3946,12 +3946,15 @@ function collectCompleteParallelToolResultGroups({
3946
3946
  existing.invalid = true;
3947
3947
  continue;
3948
3948
  }
3949
+ if (existing.metadata.input === void 0 && metadata.input !== void 0) {
3950
+ existing.metadata = metadata;
3951
+ }
3949
3952
  existing.results.set(metadata.index, part);
3950
3953
  }
3951
3954
  }
3952
3955
  const completeGroups = /* @__PURE__ */ new Map();
3953
3956
  for (const [toolCallId, group] of pendingGroups) {
3954
- if (group.invalid || group.results.size !== group.metadata.count) {
3957
+ if (group.invalid || group.results.size !== group.metadata.count || group.metadata.input === void 0) {
3955
3958
  continue;
3956
3959
  }
3957
3960
  const results = Array.from(
@@ -3960,7 +3963,7 @@ function collectCompleteParallelToolResultGroups({
3960
3963
  );
3961
3964
  if (results.every(isNonNullable)) {
3962
3965
  completeGroups.set(toolCallId, {
3963
- metadata: group.metadata,
3966
+ metadata: { ...group.metadata, input: group.metadata.input },
3964
3967
  results
3965
3968
  });
3966
3969
  }
@@ -8719,7 +8722,7 @@ var OpenAITranscriptionModel = class {
8719
8722
  };
8720
8723
 
8721
8724
  // src/version.ts
8722
- var VERSION = true ? "3.0.138" : "0.0.0-test";
8725
+ var VERSION = true ? "3.0.140" : "0.0.0-test";
8723
8726
 
8724
8727
  // src/openai-provider.ts
8725
8728
  function createOpenAI(options = {}) {