@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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 3.0.69
4
+
5
+ ### Patch Changes
6
+
7
+ - e7664a4: feat(provider/xai): support multiple input images for image editing
8
+
9
+ ## 3.0.68
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [64ac0fd]
14
+ - @ai-sdk/provider-utils@4.0.20
15
+ - @ai-sdk/openai-compatible@2.0.36
16
+
3
17
  ## 3.0.67
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -902,7 +902,7 @@ var XaiImageModel = class {
902
902
  this.modelId = modelId;
903
903
  this.config = config;
904
904
  this.specificationVersion = "v3";
905
- this.maxImagesPerCall = 1;
905
+ this.maxImagesPerCall = 3;
906
906
  }
907
907
  get provider() {
908
908
  return this.config.provider;
@@ -946,16 +946,7 @@ var XaiImageModel = class {
946
946
  schema: xaiImageModelOptions
947
947
  });
948
948
  const hasFiles = files != null && files.length > 0;
949
- let imageUrl;
950
- if (hasFiles) {
951
- imageUrl = (0, import_provider_utils4.convertImageModelFileToDataUri)(files[0]);
952
- if (files.length > 1) {
953
- warnings.push({
954
- type: "other",
955
- message: "xAI only supports a single input image. Additional images are ignored."
956
- });
957
- }
958
- }
949
+ const imageUrls = hasFiles ? files.map((file) => (0, import_provider_utils4.convertImageModelFileToDataUri)(file)) : [];
959
950
  const endpoint = hasFiles ? "/images/edits" : "/images/generations";
960
951
  const body = {
961
952
  model: this.modelId,
@@ -978,8 +969,10 @@ var XaiImageModel = class {
978
969
  if ((xaiOptions == null ? void 0 : xaiOptions.resolution) != null) {
979
970
  body.resolution = xaiOptions.resolution;
980
971
  }
981
- if (imageUrl != null) {
982
- body.image = { url: imageUrl, type: "image_url" };
972
+ if (imageUrls.length === 1) {
973
+ body.image = { url: imageUrls[0], type: "image_url" };
974
+ } else if (imageUrls.length > 1) {
975
+ body.images = imageUrls.map((url) => ({ url, type: "image_url" }));
983
976
  }
984
977
  const baseURL = (_a = this.config.baseURL) != null ? _a : "https://api.x.ai/v1";
985
978
  const currentDate = (_d = (_c = (_b = this.config._internal) == null ? void 0 : _b.currentDate) == null ? void 0 : _c.call(_b)) != null ? _d : /* @__PURE__ */ new Date();
@@ -2706,7 +2699,7 @@ var xaiTools = {
2706
2699
  };
2707
2700
 
2708
2701
  // src/version.ts
2709
- var VERSION = true ? "3.0.67" : "0.0.0-test";
2702
+ var VERSION = true ? "3.0.69" : "0.0.0-test";
2710
2703
 
2711
2704
  // src/xai-video-model.ts
2712
2705
  var import_provider6 = require("@ai-sdk/provider");