@ai-sdk/xai 3.0.67 → 3.0.69
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 +14 -0
- package/dist/index.js +7 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -14
- package/dist/index.mjs.map +1 -1
- package/docs/01-xai.mdx +22 -1
- package/package.json +4 -4
- package/src/xai-image-model.ts +8 -16
package/dist/index.mjs
CHANGED
|
@@ -897,7 +897,7 @@ var XaiImageModel = class {
|
|
|
897
897
|
this.modelId = modelId;
|
|
898
898
|
this.config = config;
|
|
899
899
|
this.specificationVersion = "v3";
|
|
900
|
-
this.maxImagesPerCall =
|
|
900
|
+
this.maxImagesPerCall = 3;
|
|
901
901
|
}
|
|
902
902
|
get provider() {
|
|
903
903
|
return this.config.provider;
|
|
@@ -941,16 +941,7 @@ var XaiImageModel = class {
|
|
|
941
941
|
schema: xaiImageModelOptions
|
|
942
942
|
});
|
|
943
943
|
const hasFiles = files != null && files.length > 0;
|
|
944
|
-
|
|
945
|
-
if (hasFiles) {
|
|
946
|
-
imageUrl = convertImageModelFileToDataUri(files[0]);
|
|
947
|
-
if (files.length > 1) {
|
|
948
|
-
warnings.push({
|
|
949
|
-
type: "other",
|
|
950
|
-
message: "xAI only supports a single input image. Additional images are ignored."
|
|
951
|
-
});
|
|
952
|
-
}
|
|
953
|
-
}
|
|
944
|
+
const imageUrls = hasFiles ? files.map((file) => convertImageModelFileToDataUri(file)) : [];
|
|
954
945
|
const endpoint = hasFiles ? "/images/edits" : "/images/generations";
|
|
955
946
|
const body = {
|
|
956
947
|
model: this.modelId,
|
|
@@ -973,8 +964,10 @@ var XaiImageModel = class {
|
|
|
973
964
|
if ((xaiOptions == null ? void 0 : xaiOptions.resolution) != null) {
|
|
974
965
|
body.resolution = xaiOptions.resolution;
|
|
975
966
|
}
|
|
976
|
-
if (
|
|
977
|
-
body.image = { url:
|
|
967
|
+
if (imageUrls.length === 1) {
|
|
968
|
+
body.image = { url: imageUrls[0], type: "image_url" };
|
|
969
|
+
} else if (imageUrls.length > 1) {
|
|
970
|
+
body.images = imageUrls.map((url) => ({ url, type: "image_url" }));
|
|
978
971
|
}
|
|
979
972
|
const baseURL = (_a = this.config.baseURL) != null ? _a : "https://api.x.ai/v1";
|
|
980
973
|
const currentDate = (_d = (_c = (_b = this.config._internal) == null ? void 0 : _b.currentDate) == null ? void 0 : _c.call(_b)) != null ? _d : /* @__PURE__ */ new Date();
|
|
@@ -2727,7 +2720,7 @@ var xaiTools = {
|
|
|
2727
2720
|
};
|
|
2728
2721
|
|
|
2729
2722
|
// src/version.ts
|
|
2730
|
-
var VERSION = true ? "3.0.
|
|
2723
|
+
var VERSION = true ? "3.0.69" : "0.0.0-test";
|
|
2731
2724
|
|
|
2732
2725
|
// src/xai-video-model.ts
|
|
2733
2726
|
import {
|