@ai-sdk/openai 3.0.51 → 3.0.53

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": "3.0.51",
3
+ "version": "3.0.53",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -36,8 +36,8 @@
36
36
  }
37
37
  },
38
38
  "dependencies": {
39
- "@ai-sdk/provider": "3.0.8",
40
- "@ai-sdk/provider-utils": "4.0.23"
39
+ "@ai-sdk/provider-utils": "4.0.23",
40
+ "@ai-sdk/provider": "3.0.8"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "20.17.24",
@@ -6,6 +6,10 @@ import {
6
6
  import { OpenAIChatPrompt } from './openai-chat-prompt';
7
7
  import { convertToBase64 } from '@ai-sdk/provider-utils';
8
8
 
9
+ function serializeToolCallArguments(input: unknown): string {
10
+ return JSON.stringify(input === undefined ? {} : input);
11
+ }
12
+
9
13
  export function convertToOpenAIChatMessages({
10
14
  prompt,
11
15
  systemMessageMode = 'system',
@@ -165,7 +169,7 @@ export function convertToOpenAIChatMessages({
165
169
  type: 'function',
166
170
  function: {
167
171
  name: part.toolName,
168
- arguments: JSON.stringify(part.input),
172
+ arguments: serializeToolCallArguments(part.input),
169
173
  },
170
174
  });
171
175
  break;
@@ -33,6 +33,10 @@ import {
33
33
  OpenAIResponsesReasoning,
34
34
  } from './openai-responses-api';
35
35
 
36
+ function serializeToolCallArguments(input: unknown): string {
37
+ return JSON.stringify(input === undefined ? {} : input);
38
+ }
39
+
36
40
  /**
37
41
  * Check if a string is a file ID based on the given prefixes
38
42
  * Returns false if prefixes is undefined (disables file ID detection)
@@ -334,7 +338,7 @@ export async function convertToOpenAIResponsesInput({
334
338
  type: 'function_call',
335
339
  call_id: part.toolCallId,
336
340
  name: resolvedToolName,
337
- arguments: JSON.stringify(part.input),
341
+ arguments: serializeToolCallArguments(part.input),
338
342
  id,
339
343
  });
340
344
  break;