@ai-sdk/xai 3.0.123 → 3.0.125

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,21 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 3.0.125
4
+
5
+ ### Patch Changes
6
+
7
+ - f33a407: fix(provider/xai): report image moderation blocks as content policy errors
8
+ - Updated dependencies [2d172fb]
9
+ - @ai-sdk/provider-utils@4.0.47
10
+ - @ai-sdk/openai-compatible@2.0.71
11
+
12
+ ## 3.0.124
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [c79dd10]
17
+ - @ai-sdk/openai-compatible@2.0.70
18
+
3
19
  ## 3.0.123
4
20
 
5
21
  ### Patch Changes
package/README.md CHANGED
@@ -36,7 +36,7 @@ import { xai } from '@ai-sdk/xai';
36
36
  import { generateText } from 'ai';
37
37
 
38
38
  const { text } = await generateText({
39
- model: xai('grok-3'),
39
+ model: xai('grok-4.6'),
40
40
  prompt: 'Write a vegetarian lasagna recipe for 4 people.',
41
41
  });
42
42
  ```
package/dist/index.js CHANGED
@@ -1077,6 +1077,11 @@ var XaiImageModel = class {
1077
1077
  abortSignal,
1078
1078
  fetch: this.config.fetch
1079
1079
  });
1080
+ if (response.data.some((image) => image.respect_moderation === false)) {
1081
+ throw new Error(
1082
+ "Image generation was blocked due to a content policy violation."
1083
+ );
1084
+ }
1080
1085
  const hasAllBase64 = response.data.every((image) => image.b64_json != null);
1081
1086
  const images = hasAllBase64 ? response.data.map((image) => image.b64_json) : await Promise.all(
1082
1087
  response.data.map(
@@ -1117,7 +1122,8 @@ var xaiImageResponseSchema = import_v46.z.object({
1117
1122
  import_v46.z.object({
1118
1123
  url: import_v46.z.string().nullish(),
1119
1124
  b64_json: import_v46.z.string().nullish(),
1120
- revised_prompt: import_v46.z.string().nullish()
1125
+ revised_prompt: import_v46.z.string().nullish(),
1126
+ respect_moderation: import_v46.z.boolean().nullish()
1121
1127
  })
1122
1128
  ),
1123
1129
  usage: import_v46.z.object({
@@ -2967,7 +2973,7 @@ var xaiTools = {
2967
2973
  };
2968
2974
 
2969
2975
  // src/version.ts
2970
- var VERSION = true ? "3.0.123" : "0.0.0-test";
2976
+ var VERSION = true ? "3.0.125" : "0.0.0-test";
2971
2977
 
2972
2978
  // src/xai-video-model.ts
2973
2979
  var import_provider6 = require("@ai-sdk/provider");