@ai-sdk/xai 4.0.38 → 4.0.39

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,11 @@
1
1
  # @ai-sdk/xai
2
2
 
3
+ ## 4.0.39
4
+
5
+ ### Patch Changes
6
+
7
+ - 646c86e: fix(provider/xai): report video moderation blocks and missing URLs as an error status instead of throwing
8
+
3
9
  ## 4.0.38
4
10
 
5
11
  ### 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
@@ -3720,7 +3720,7 @@ var xaiTools = {
3720
3720
  };
3721
3721
 
3722
3722
  // src/version.ts
3723
- var VERSION = true ? "4.0.38" : "0.0.0-test";
3723
+ var VERSION = true ? "4.0.39" : "0.0.0-test";
3724
3724
 
3725
3725
  // src/files/xai-files.ts
3726
3726
  import {
@@ -4218,16 +4218,26 @@ var XaiVideoModel = class {
4218
4218
  }
4219
4219
  if (statusResponse.status === "done" || statusResponse.status == null && ((_h = statusResponse.video) == null ? void 0 : _h.url)) {
4220
4220
  if (((_i = statusResponse.video) == null ? void 0 : _i.respect_moderation) === false) {
4221
- throw new AISDKError({
4222
- name: "XAI_VIDEO_MODERATION_ERROR",
4223
- message: "Video generation was blocked due to a content policy violation."
4224
- });
4221
+ return {
4222
+ status: "error",
4223
+ error: "Video generation was blocked due to a content policy violation.",
4224
+ response: {
4225
+ timestamp: currentDate,
4226
+ modelId: this.modelId,
4227
+ headers: responseHeaders
4228
+ }
4229
+ };
4225
4230
  }
4226
4231
  if (!((_j = statusResponse.video) == null ? void 0 : _j.url)) {
4227
- throw new AISDKError({
4228
- name: "XAI_VIDEO_GENERATION_ERROR",
4229
- message: "Video generation completed but no video URL was returned."
4230
- });
4232
+ return {
4233
+ status: "error",
4234
+ error: "Video generation completed but no video URL was returned.",
4235
+ response: {
4236
+ timestamp: currentDate,
4237
+ modelId: this.modelId,
4238
+ headers: responseHeaders
4239
+ }
4240
+ };
4231
4241
  }
4232
4242
  return {
4233
4243
  status: "completed",