@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 +10 -0
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +13 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +15 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/chat/convert-to-openai-compatible-chat-messages.ts +16 -2
package/dist/index.mjs
CHANGED
|
@@ -90,6 +90,8 @@ import {
|
|
|
90
90
|
UnsupportedFunctionalityError
|
|
91
91
|
} from "@ai-sdk/provider";
|
|
92
92
|
import {
|
|
93
|
+
secureJsonParse,
|
|
94
|
+
stringifyWithBigIntAndCycles,
|
|
93
95
|
convertBase64ToUint8Array,
|
|
94
96
|
convertToBase64
|
|
95
97
|
} from "@ai-sdk/provider-utils";
|
|
@@ -108,6 +110,17 @@ function getAudioFormat(mediaType) {
|
|
|
108
110
|
return null;
|
|
109
111
|
}
|
|
110
112
|
}
|
|
113
|
+
function serializeToolCallArguments(input) {
|
|
114
|
+
if (typeof input === "string") {
|
|
115
|
+
try {
|
|
116
|
+
secureJsonParse(input);
|
|
117
|
+
return input;
|
|
118
|
+
} catch (e) {
|
|
119
|
+
return JSON.stringify(input);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return stringifyWithBigIntAndCycles(input);
|
|
123
|
+
}
|
|
111
124
|
function convertToOpenAICompatibleChatMessages(prompt) {
|
|
112
125
|
var _a, _b, _c;
|
|
113
126
|
const messages = [];
|
|
@@ -225,7 +238,7 @@ function convertToOpenAICompatibleChatMessages(prompt) {
|
|
|
225
238
|
type: "function",
|
|
226
239
|
function: {
|
|
227
240
|
name: part.toolName,
|
|
228
|
-
arguments:
|
|
241
|
+
arguments: serializeToolCallArguments(part.input)
|
|
229
242
|
},
|
|
230
243
|
...partMetadata,
|
|
231
244
|
// Include extra_content for Google Gemini thought signatures
|
|
@@ -268,7 +281,7 @@ function convertToOpenAICompatibleChatMessages(prompt) {
|
|
|
268
281
|
case "content":
|
|
269
282
|
case "json":
|
|
270
283
|
case "error-json":
|
|
271
|
-
contentValue =
|
|
284
|
+
contentValue = stringifyWithBigIntAndCycles(output.value);
|
|
272
285
|
break;
|
|
273
286
|
}
|
|
274
287
|
const toolResponseMetadata = getOpenAIMetadata(toolResponse);
|
|
@@ -1821,7 +1834,7 @@ import {
|
|
|
1821
1834
|
} from "@ai-sdk/provider-utils";
|
|
1822
1835
|
|
|
1823
1836
|
// src/version.ts
|
|
1824
|
-
var VERSION = true ? "2.0.
|
|
1837
|
+
var VERSION = true ? "2.0.90" : "0.0.0-test";
|
|
1825
1838
|
|
|
1826
1839
|
// src/openai-compatible-provider.ts
|
|
1827
1840
|
function createOpenAICompatible(options) {
|