@ai-sdk/xai 3.0.89 → 3.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 +6 -0
- package/dist/index.js +23 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +23 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/remove-additional-properties.ts +24 -0
- package/src/responses/xai-responses-prepare-tools.ts +2 -1
- package/src/xai-prepare-tools.ts +2 -1
package/dist/index.mjs
CHANGED
|
@@ -297,6 +297,26 @@ var xaiFailedResponseHandler = createJsonErrorResponseHandler({
|
|
|
297
297
|
import {
|
|
298
298
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError2
|
|
299
299
|
} from "@ai-sdk/provider";
|
|
300
|
+
|
|
301
|
+
// src/remove-additional-properties.ts
|
|
302
|
+
function removeAdditionalPropertiesFalse(value) {
|
|
303
|
+
if (Array.isArray(value)) {
|
|
304
|
+
return value.map(removeAdditionalPropertiesFalse);
|
|
305
|
+
}
|
|
306
|
+
if (value == null || typeof value !== "object") {
|
|
307
|
+
return value;
|
|
308
|
+
}
|
|
309
|
+
const result = {};
|
|
310
|
+
for (const [key, propertyValue] of Object.entries(value)) {
|
|
311
|
+
if (key === "additionalProperties" && propertyValue === false) {
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
result[key] = removeAdditionalPropertiesFalse(propertyValue);
|
|
315
|
+
}
|
|
316
|
+
return result;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// src/xai-prepare-tools.ts
|
|
300
320
|
function prepareTools({
|
|
301
321
|
tools,
|
|
302
322
|
toolChoice
|
|
@@ -319,7 +339,7 @@ function prepareTools({
|
|
|
319
339
|
function: {
|
|
320
340
|
name: tool.name,
|
|
321
341
|
description: tool.description,
|
|
322
|
-
parameters: tool.inputSchema,
|
|
342
|
+
parameters: removeAdditionalPropertiesFalse(tool.inputSchema),
|
|
323
343
|
...tool.strict != null ? { strict: tool.strict } : {}
|
|
324
344
|
}
|
|
325
345
|
});
|
|
@@ -1991,7 +2011,7 @@ async function prepareResponsesTools({
|
|
|
1991
2011
|
type: "function",
|
|
1992
2012
|
name: tool.name,
|
|
1993
2013
|
description: tool.description,
|
|
1994
|
-
parameters: tool.inputSchema,
|
|
2014
|
+
parameters: removeAdditionalPropertiesFalse(tool.inputSchema),
|
|
1995
2015
|
...tool.strict != null ? { strict: tool.strict } : {}
|
|
1996
2016
|
});
|
|
1997
2017
|
}
|
|
@@ -2821,7 +2841,7 @@ var xaiTools = {
|
|
|
2821
2841
|
};
|
|
2822
2842
|
|
|
2823
2843
|
// src/version.ts
|
|
2824
|
-
var VERSION = true ? "3.0.
|
|
2844
|
+
var VERSION = true ? "3.0.90" : "0.0.0-test";
|
|
2825
2845
|
|
|
2826
2846
|
// src/xai-video-model.ts
|
|
2827
2847
|
import {
|