@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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.140
4
+
5
+ ### Patch Changes
6
+
7
+ - e38b209: Avoid repeating the complete parallel-tool wrapper input in every expanded tool call's metadata while preserving wrapper reconstruction for follow-up Responses API requests.
8
+ - Updated dependencies [88bb257]
9
+ - @ai-sdk/provider-utils@4.0.66
10
+
3
11
  ## 3.0.139
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3552,7 +3552,7 @@ function getParallelToolCallMetadata({
3552
3552
  }) {
3553
3553
  var _a2;
3554
3554
  const metadata = (_a2 = providerOptions == null ? void 0 : providerOptions[providerOptionsName]) == null ? void 0 : _a2.parallelToolCall;
3555
- 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) {
3555
+ 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) {
3556
3556
  return void 0;
3557
3557
  }
3558
3558
  return metadata;
@@ -3606,7 +3606,7 @@ async function expandParallelToolCall({
3606
3606
  itemId,
3607
3607
  toolCallId: toolCall.toolCallId,
3608
3608
  toolName: toolCall.toolName,
3609
- input: toolCall.input,
3609
+ ...index === 0 && { input: toolCall.input },
3610
3610
  index,
3611
3611
  count: toolUses.length
3612
3612
  }
@@ -3793,7 +3793,7 @@ async function convertFunctionToolResultOutput({
3793
3793
  }
3794
3794
  }
3795
3795
  function hasSameParallelToolCall(first, second) {
3796
- return first.itemId === second.itemId && first.toolCallId === second.toolCallId && first.toolName === second.toolName && first.input === second.input && first.count === second.count;
3796
+ 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;
3797
3797
  }
3798
3798
  function collectCompleteParallelToolResultGroups({
3799
3799
  prompt,
@@ -3828,12 +3828,15 @@ function collectCompleteParallelToolResultGroups({
3828
3828
  existing.invalid = true;
3829
3829
  continue;
3830
3830
  }
3831
+ if (existing.metadata.input === void 0 && metadata.input !== void 0) {
3832
+ existing.metadata = metadata;
3833
+ }
3831
3834
  existing.results.set(metadata.index, part);
3832
3835
  }
3833
3836
  }
3834
3837
  const completeGroups = /* @__PURE__ */ new Map();
3835
3838
  for (const [toolCallId, group] of pendingGroups) {
3836
- if (group.invalid || group.results.size !== group.metadata.count) {
3839
+ if (group.invalid || group.results.size !== group.metadata.count || group.metadata.input === void 0) {
3837
3840
  continue;
3838
3841
  }
3839
3842
  const results = Array.from(
@@ -3842,7 +3845,7 @@ function collectCompleteParallelToolResultGroups({
3842
3845
  );
3843
3846
  if (results.every(import_provider_utils28.isNonNullable)) {
3844
3847
  completeGroups.set(toolCallId, {
3845
- metadata: group.metadata,
3848
+ metadata: { ...group.metadata, input: group.metadata.input },
3846
3849
  results
3847
3850
  });
3848
3851
  }
@@ -8578,7 +8581,7 @@ var OpenAITranscriptionModel = class {
8578
8581
  };
8579
8582
 
8580
8583
  // src/version.ts
8581
- var VERSION = true ? "3.0.139" : "0.0.0-test";
8584
+ var VERSION = true ? "3.0.140" : "0.0.0-test";
8582
8585
 
8583
8586
  // src/openai-provider.ts
8584
8587
  function createOpenAI(options = {}) {