@ai-sdk/xai 2.0.70 → 2.0.71
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 +12 -0
- package/dist/index.js +13 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1309,9 +1309,14 @@ async function convertToXaiResponsesInput({
|
|
|
1309
1309
|
const mediaType = block.mediaType === "image/*" ? "image/jpeg" : block.mediaType;
|
|
1310
1310
|
const imageUrl = block.data instanceof URL ? block.data.toString() : `data:${mediaType};base64,${convertToBase642(block.data)}`;
|
|
1311
1311
|
contentParts.push({ type: "input_image", image_url: imageUrl });
|
|
1312
|
+
} else if (block.data instanceof URL) {
|
|
1313
|
+
contentParts.push({
|
|
1314
|
+
type: "input_file",
|
|
1315
|
+
file_url: block.data.toString()
|
|
1316
|
+
});
|
|
1312
1317
|
} else {
|
|
1313
1318
|
throw new UnsupportedFunctionalityError3({
|
|
1314
|
-
functionality: `file part media type ${block.mediaType}`
|
|
1319
|
+
functionality: `file part media type ${block.mediaType} as inline data (xAI Responses requires a URL or a Files API reference for non-image files)`
|
|
1315
1320
|
});
|
|
1316
1321
|
}
|
|
1317
1322
|
break;
|
|
@@ -1689,7 +1694,12 @@ var XaiResponsesLanguageModel = class {
|
|
|
1689
1694
|
constructor(modelId, config) {
|
|
1690
1695
|
this.specificationVersion = "v2";
|
|
1691
1696
|
this.supportedUrls = {
|
|
1692
|
-
"image/*": [/^https?:\/\/.*$/]
|
|
1697
|
+
"image/*": [/^https?:\/\/.*$/],
|
|
1698
|
+
// xAI's Responses API accepts non-image documents (PDF, plain text, CSV, etc.) as
|
|
1699
|
+
// `{ type: 'input_file', file_url }`. Keeping these URLs intact here lets them pass
|
|
1700
|
+
// through to the converter instead of being downloaded to bytes by the SDK.
|
|
1701
|
+
"application/pdf": [/^https?:\/\/.*$/],
|
|
1702
|
+
"text/*": [/^https?:\/\/.*$/]
|
|
1693
1703
|
};
|
|
1694
1704
|
this.modelId = modelId;
|
|
1695
1705
|
this.config = config;
|
|
@@ -2354,7 +2364,7 @@ var xaiTools = {
|
|
|
2354
2364
|
};
|
|
2355
2365
|
|
|
2356
2366
|
// src/version.ts
|
|
2357
|
-
var VERSION = true ? "2.0.
|
|
2367
|
+
var VERSION = true ? "2.0.71" : "0.0.0-test";
|
|
2358
2368
|
|
|
2359
2369
|
// src/xai-provider.ts
|
|
2360
2370
|
var xaiErrorStructure = {
|