@ai-sdk/openai 2.0.0-beta.7 → 2.0.0-beta.8

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
+ ## 2.0.0-beta.8
4
+
5
+ ### Patch Changes
6
+
7
+ - db64cbe: fix (provider/openai): multi-step reasoning with tool calls
8
+ - Updated dependencies [05d2819]
9
+ - @ai-sdk/provider-utils@3.0.0-beta.3
10
+
3
11
  ## 2.0.0-beta.7
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1879,7 +1879,7 @@ async function convertToOpenAIResponsesMessages({
1879
1879
  prompt,
1880
1880
  systemMessageMode
1881
1881
  }) {
1882
- var _a, _b;
1882
+ var _a, _b, _c, _d, _e;
1883
1883
  const messages = [];
1884
1884
  const warnings = [];
1885
1885
  for (const { role, content } of prompt) {
@@ -1914,7 +1914,7 @@ async function convertToOpenAIResponsesMessages({
1914
1914
  messages.push({
1915
1915
  role: "user",
1916
1916
  content: content.map((part, index) => {
1917
- var _a2, _b2, _c;
1917
+ var _a2, _b2, _c2;
1918
1918
  switch (part.type) {
1919
1919
  case "text": {
1920
1920
  return { type: "input_text", text: part.text };
@@ -1936,7 +1936,7 @@ async function convertToOpenAIResponsesMessages({
1936
1936
  }
1937
1937
  return {
1938
1938
  type: "input_file",
1939
- filename: (_c = part.filename) != null ? _c : `part-${index}.pdf`,
1939
+ filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
1940
1940
  file_data: `data:application/pdf;base64,${part.data}`
1941
1941
  };
1942
1942
  } else {
@@ -1969,7 +1969,8 @@ async function convertToOpenAIResponsesMessages({
1969
1969
  type: "function_call",
1970
1970
  call_id: part.toolCallId,
1971
1971
  name: part.toolName,
1972
- arguments: JSON.stringify(part.input)
1972
+ arguments: JSON.stringify(part.input),
1973
+ id: (_c = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId) != null ? _c : void 0
1973
1974
  });
1974
1975
  break;
1975
1976
  }
@@ -1986,7 +1987,7 @@ async function convertToOpenAIResponsesMessages({
1986
1987
  providerOptions: part.providerOptions,
1987
1988
  schema: openaiResponsesReasoningProviderOptionsSchema
1988
1989
  });
1989
- const reasoningId = (_a = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _a.id;
1990
+ const reasoningId = (_d = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _d.id;
1990
1991
  if (reasoningId != null) {
1991
1992
  const existingReasoningMessage = reasoningMessages[reasoningId];
1992
1993
  const summaryParts = [];
@@ -2002,7 +2003,7 @@ async function convertToOpenAIResponsesMessages({
2002
2003
  reasoningMessages[reasoningId] = {
2003
2004
  type: "reasoning",
2004
2005
  id: reasoningId,
2005
- encrypted_content: (_b = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _b.encryptedContent,
2006
+ encrypted_content: (_e = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _e.encryptedContent,
2006
2007
  summary: summaryParts
2007
2008
  };
2008
2009
  messages.push(reasoningMessages[reasoningId]);
@@ -2367,7 +2368,8 @@ var OpenAIResponsesLanguageModel = class {
2367
2368
  type: import_v414.z.literal("function_call"),
2368
2369
  call_id: import_v414.z.string(),
2369
2370
  name: import_v414.z.string(),
2370
- arguments: import_v414.z.string()
2371
+ arguments: import_v414.z.string(),
2372
+ id: import_v414.z.string()
2371
2373
  }),
2372
2374
  import_v414.z.object({
2373
2375
  type: import_v414.z.literal("web_search_call"),
@@ -2456,7 +2458,12 @@ var OpenAIResponsesLanguageModel = class {
2456
2458
  type: "tool-call",
2457
2459
  toolCallId: part.call_id,
2458
2460
  toolName: part.name,
2459
- input: part.arguments
2461
+ input: part.arguments,
2462
+ providerMetadata: {
2463
+ openai: {
2464
+ itemId: part.id
2465
+ }
2466
+ }
2460
2467
  });
2461
2468
  break;
2462
2469
  }
@@ -2641,7 +2648,12 @@ var OpenAIResponsesLanguageModel = class {
2641
2648
  type: "tool-call",
2642
2649
  toolCallId: value.item.call_id,
2643
2650
  toolName: value.item.name,
2644
- input: value.item.arguments
2651
+ input: value.item.arguments,
2652
+ providerMetadata: {
2653
+ openai: {
2654
+ itemId: value.item.id
2655
+ }
2656
+ }
2645
2657
  });
2646
2658
  } else if (value.item.type === "web_search_call") {
2647
2659
  ongoingToolCalls[value.output_index] = void 0;