@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/openai",
3
- "version": "4.0.0-beta.31",
3
+ "version": "4.0.0-beta.32",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -35,8 +35,8 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@ai-sdk/provider": "4.0.0-beta.12",
39
- "@ai-sdk/provider-utils": "5.0.0-beta.20"
38
+ "@ai-sdk/provider-utils": "5.0.0-beta.20",
39
+ "@ai-sdk/provider": "4.0.0-beta.12"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@types/node": "20.17.24",
@@ -10,6 +10,10 @@ import {
10
10
  resolveProviderReference,
11
11
  } from '@ai-sdk/provider-utils';
12
12
 
13
+ function serializeToolCallArguments(input: unknown): string {
14
+ return JSON.stringify(input === undefined ? {} : input);
15
+ }
16
+
13
17
  export function convertToOpenAIChatMessages({
14
18
  prompt,
15
19
  systemMessageMode = 'system',
@@ -176,7 +180,7 @@ export function convertToOpenAIChatMessages({
176
180
  type: 'function',
177
181
  function: {
178
182
  name: part.toolName,
179
- arguments: JSON.stringify(part.input),
183
+ arguments: serializeToolCallArguments(part.input),
180
184
  },
181
185
  });
182
186
  break;
@@ -36,6 +36,10 @@ import {
36
36
  toolSearchOutputSchema,
37
37
  } from '../tool/tool-search';
38
38
 
39
+ function serializeToolCallArguments(input: unknown): string {
40
+ return JSON.stringify(input === undefined ? {} : input);
41
+ }
42
+
39
43
  /**
40
44
  * This is soft-deprecated. Use provider references instead. Kept for backward compatibility
41
45
  * with the `fileIdPrefixes` option.
@@ -362,7 +366,7 @@ export async function convertToOpenAIResponsesInput({
362
366
  type: 'function_call',
363
367
  call_id: part.toolCallId,
364
368
  name: resolvedToolName,
365
- arguments: JSON.stringify(part.input),
369
+ arguments: serializeToolCallArguments(part.input),
366
370
  id,
367
371
  });
368
372
  break;