@ai-sdk/openai-compatible 2.0.89 → 2.0.90

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,15 @@
1
1
  # @ai-sdk/openai-compatible
2
2
 
3
+ ## 2.0.90
4
+
5
+ ### Patch Changes
6
+
7
+ - d900e58: fix(openai-compatible): preserve string tool call arguments and safely serialize BigInt and circular structures in tool calls and outputs
8
+ - Updated dependencies [d900e58]
9
+ - Updated dependencies [d900e58]
10
+ - Updated dependencies [d900e58]
11
+ - @ai-sdk/provider-utils@4.0.64
12
+
3
13
  ## 2.0.89
4
14
 
5
15
  ### Patch Changes
package/dist/index.js CHANGED
@@ -121,6 +121,17 @@ function getAudioFormat(mediaType) {
121
121
  return null;
122
122
  }
123
123
  }
124
+ function serializeToolCallArguments(input) {
125
+ if (typeof input === "string") {
126
+ try {
127
+ (0, import_provider_utils.secureJsonParse)(input);
128
+ return input;
129
+ } catch (e) {
130
+ return JSON.stringify(input);
131
+ }
132
+ }
133
+ return (0, import_provider_utils.stringifyWithBigIntAndCycles)(input);
134
+ }
124
135
  function convertToOpenAICompatibleChatMessages(prompt) {
125
136
  var _a, _b, _c;
126
137
  const messages = [];
@@ -238,7 +249,7 @@ function convertToOpenAICompatibleChatMessages(prompt) {
238
249
  type: "function",
239
250
  function: {
240
251
  name: part.toolName,
241
- arguments: JSON.stringify(part.input)
252
+ arguments: serializeToolCallArguments(part.input)
242
253
  },
243
254
  ...partMetadata,
244
255
  // Include extra_content for Google Gemini thought signatures
@@ -281,7 +292,7 @@ function convertToOpenAICompatibleChatMessages(prompt) {
281
292
  case "content":
282
293
  case "json":
283
294
  case "error-json":
284
- contentValue = JSON.stringify(output.value);
295
+ contentValue = (0, import_provider_utils.stringifyWithBigIntAndCycles)(output.value);
285
296
  break;
286
297
  }
287
298
  const toolResponseMetadata = getOpenAIMetadata(toolResponse);
@@ -1785,7 +1796,7 @@ async function fileToBlob(file) {
1785
1796
  var import_provider_utils8 = require("@ai-sdk/provider-utils");
1786
1797
 
1787
1798
  // src/version.ts
1788
- var VERSION = true ? "2.0.89" : "0.0.0-test";
1799
+ var VERSION = true ? "2.0.90" : "0.0.0-test";
1789
1800
 
1790
1801
  // src/openai-compatible-provider.ts
1791
1802
  function createOpenAICompatible(options) {