@ai-sdk/xai 4.0.40 → 4.0.42

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,18 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 4.0.42
4
+
5
+ ### Patch Changes
6
+
7
+ - ef05760: fix(provider/xai): report image moderation blocks as content policy errors
8
+
9
+ ## 4.0.41
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [e6087c9]
14
+ - @ai-sdk/provider-utils@5.0.28
15
+
3
16
  ## 4.0.40
4
17
 
5
18
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1181,6 +1181,11 @@ var XaiImageModel = class _XaiImageModel {
1181
1181
  abortSignal,
1182
1182
  fetch: this.config.fetch
1183
1183
  });
1184
+ if (response.data.some((image) => image.respect_moderation === false)) {
1185
+ throw new Error(
1186
+ "Image generation was blocked due to a content policy violation."
1187
+ );
1188
+ }
1184
1189
  const hasAllBase64 = response.data.every((image) => image.b64_json != null);
1185
1190
  const images = hasAllBase64 ? response.data.map((image) => image.b64_json) : await Promise.all(
1186
1191
  response.data.map(
@@ -1224,7 +1229,8 @@ var xaiImageResponseSchema = z6.object({
1224
1229
  z6.object({
1225
1230
  url: z6.string().nullish(),
1226
1231
  b64_json: z6.string().nullish(),
1227
- revised_prompt: z6.string().nullish()
1232
+ revised_prompt: z6.string().nullish(),
1233
+ respect_moderation: z6.boolean().nullish()
1228
1234
  })
1229
1235
  ),
1230
1236
  usage: z6.object({
@@ -3729,7 +3735,7 @@ var xaiTools = {
3729
3735
  };
3730
3736
 
3731
3737
  // src/version.ts
3732
- var VERSION = true ? "4.0.40" : "0.0.0-test";
3738
+ var VERSION = true ? "4.0.42" : "0.0.0-test";
3733
3739
 
3734
3740
  // src/files/xai-files.ts
3735
3741
  import {