@ai-sdk/openai 4.0.0-beta.31 → 4.0.0-beta.32

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,11 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 4.0.0-beta.32
4
+
5
+ ### Patch Changes
6
+
7
+ - 0c4ac8a: fix(openai): default undefined tool-call input to empty object before serializing tool arguments
8
+
3
9
  ## 4.0.0-beta.31
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -107,6 +107,9 @@ import {
107
107
  isProviderReference,
108
108
  resolveProviderReference
109
109
  } from "@ai-sdk/provider-utils";
110
+ function serializeToolCallArguments(input) {
111
+ return JSON.stringify(input === void 0 ? {} : input);
112
+ }
110
113
  function convertToOpenAIChatMessages({
111
114
  prompt,
112
115
  systemMessageMode = "system"
@@ -247,7 +250,7 @@ function convertToOpenAIChatMessages({
247
250
  type: "function",
248
251
  function: {
249
252
  name: part.toolName,
250
- arguments: JSON.stringify(part.input)
253
+ arguments: serializeToolCallArguments(part.input)
251
254
  }
252
255
  });
253
256
  break;
@@ -2896,6 +2899,9 @@ import {
2896
2899
  validateTypes
2897
2900
  } from "@ai-sdk/provider-utils";
2898
2901
  import { z as z22 } from "zod/v4";
2902
+ function serializeToolCallArguments2(input) {
2903
+ return JSON.stringify(input === void 0 ? {} : input);
2904
+ }
2899
2905
  function isFileId(data, prefixes) {
2900
2906
  if (!prefixes) return false;
2901
2907
  return prefixes.some((prefix) => data.startsWith(prefix));
@@ -3136,7 +3142,7 @@ async function convertToOpenAIResponsesInput({
3136
3142
  type: "function_call",
3137
3143
  call_id: part.toolCallId,
3138
3144
  name: resolvedToolName,
3139
- arguments: JSON.stringify(part.input),
3145
+ arguments: serializeToolCallArguments2(part.input),
3140
3146
  id
3141
3147
  });
3142
3148
  break;
@@ -7142,7 +7148,7 @@ var OpenAISkills = class {
7142
7148
  };
7143
7149
 
7144
7150
  // src/version.ts
7145
- var VERSION = true ? "4.0.0-beta.31" : "0.0.0-test";
7151
+ var VERSION = true ? "4.0.0-beta.32" : "0.0.0-test";
7146
7152
 
7147
7153
  // src/openai-provider.ts
7148
7154
  function createOpenAI(options = {}) {