@ai-sdk/openai 3.0.139 → 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.
@@ -3574,7 +3574,7 @@ function getParallelToolCallMetadata({
3574
3574
  }) {
3575
3575
  var _a2;
3576
3576
  const metadata = (_a2 = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a2.parallelToolCall;
3577
- if (!(0, import_provider8.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) {
3577
+ if (!(0, import_provider8.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) {
3578
3578
  return void 0;
3579
3579
  }
3580
3580
  return metadata;
@@ -3628,7 +3628,7 @@ async function expandParallelToolCall({
3628
3628
  itemId,
3629
3629
  toolCallId: toolCall.toolCallId,
3630
3630
  toolName: toolCall.toolName,
3631
- input: toolCall.input,
3631
+ ...index === 0 && { input: toolCall.input },
3632
3632
  index,
3633
3633
  count: toolUses.length
3634
3634
  }
@@ -3815,7 +3815,7 @@ async function convertFunctionToolResultOutput({
3815
3815
  }
3816
3816
  }
3817
3817
  function hasSameParallelToolCall(first, second) {
3818
- return first.itemId === second.itemId && first.toolCallId === second.toolCallId && first.toolName === second.toolName && first.input === second.input && first.count === second.count;
3818
+ 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;
3819
3819
  }
3820
3820
  function collectCompleteParallelToolResultGroups({
3821
3821
  prompt,
@@ -3850,12 +3850,15 @@ function collectCompleteParallelToolResultGroups({
3850
3850
  existing.invalid = true;
3851
3851
  continue;
3852
3852
  }
3853
+ if (existing.metadata.input === void 0 && metadata.input !== void 0) {
3854
+ existing.metadata = metadata;
3855
+ }
3853
3856
  existing.results.set(metadata.index, part);
3854
3857
  }
3855
3858
  }
3856
3859
  const completeGroups = /* @__PURE__ */ new Map();
3857
3860
  for (const [toolCallId, group] of pendingGroups) {
3858
- if (group.invalid || group.results.size !== group.metadata.count) {
3861
+ if (group.invalid || group.results.size !== group.metadata.count || group.metadata.input === void 0) {
3859
3862
  continue;
3860
3863
  }
3861
3864
  const results = Array.from(
@@ -3864,7 +3867,7 @@ function collectCompleteParallelToolResultGroups({
3864
3867
  );
3865
3868
  if (results.every(import_provider_utils27.isNonNullable)) {
3866
3869
  completeGroups.set(toolCallId, {
3867
- metadata: group.metadata,
3870
+ metadata: { ...group.metadata, input: group.metadata.input },
3868
3871
  results
3869
3872
  });
3870
3873
  }