@ai-sdk/xai 3.0.72 → 3.0.73
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 -8
- package/dist/index.js +15 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -3
- package/src/xai-video-model.ts +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
+
## 3.0.73
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 12e972c: feat(provider/xai): add moderation error, and costInUsdTicks to video model
|
|
8
|
+
|
|
3
9
|
## 3.0.72
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -530,13 +536,13 @@
|
|
|
530
536
|
Before
|
|
531
537
|
|
|
532
538
|
```ts
|
|
533
|
-
model.textEmbeddingModel(
|
|
539
|
+
model.textEmbeddingModel("my-model-id");
|
|
534
540
|
```
|
|
535
541
|
|
|
536
542
|
After
|
|
537
543
|
|
|
538
544
|
```ts
|
|
539
|
-
model.embeddingModel(
|
|
545
|
+
model.embeddingModel("my-model-id");
|
|
540
546
|
```
|
|
541
547
|
|
|
542
548
|
- 2625a04: feat(openai); update spec for mcp approval
|
|
@@ -794,13 +800,13 @@
|
|
|
794
800
|
Before
|
|
795
801
|
|
|
796
802
|
```ts
|
|
797
|
-
model.textEmbeddingModel(
|
|
803
|
+
model.textEmbeddingModel("my-model-id");
|
|
798
804
|
```
|
|
799
805
|
|
|
800
806
|
After
|
|
801
807
|
|
|
802
808
|
```ts
|
|
803
|
-
model.embeddingModel(
|
|
809
|
+
model.embeddingModel("my-model-id");
|
|
804
810
|
```
|
|
805
811
|
|
|
806
812
|
- 8514146: add grok-4-1 model IDs
|
|
@@ -1343,7 +1349,7 @@
|
|
|
1343
1349
|
|
|
1344
1350
|
```js
|
|
1345
1351
|
await generateImage({
|
|
1346
|
-
model: luma.image(
|
|
1352
|
+
model: luma.image("photon-flash-1", {
|
|
1347
1353
|
maxImagesPerCall: 5,
|
|
1348
1354
|
pollIntervalMillis: 500,
|
|
1349
1355
|
}),
|
|
@@ -1356,7 +1362,7 @@
|
|
|
1356
1362
|
|
|
1357
1363
|
```js
|
|
1358
1364
|
await generateImage({
|
|
1359
|
-
model: luma.image(
|
|
1365
|
+
model: luma.image("photon-flash-1"),
|
|
1360
1366
|
prompt,
|
|
1361
1367
|
n: 10,
|
|
1362
1368
|
maxImagesPerCall: 5,
|
|
@@ -1672,7 +1678,7 @@
|
|
|
1672
1678
|
|
|
1673
1679
|
```js
|
|
1674
1680
|
await generateImage({
|
|
1675
|
-
model: luma.image(
|
|
1681
|
+
model: luma.image("photon-flash-1", {
|
|
1676
1682
|
maxImagesPerCall: 5,
|
|
1677
1683
|
pollIntervalMillis: 500,
|
|
1678
1684
|
}),
|
|
@@ -1685,7 +1691,7 @@
|
|
|
1685
1691
|
|
|
1686
1692
|
```js
|
|
1687
1693
|
await generateImage({
|
|
1688
|
-
model: luma.image(
|
|
1694
|
+
model: luma.image("photon-flash-1"),
|
|
1689
1695
|
prompt,
|
|
1690
1696
|
n: 10,
|
|
1691
1697
|
maxImagesPerCall: 5,
|
package/dist/index.js
CHANGED
|
@@ -2715,7 +2715,7 @@ var xaiTools = {
|
|
|
2715
2715
|
};
|
|
2716
2716
|
|
|
2717
2717
|
// src/version.ts
|
|
2718
|
-
var VERSION = true ? "3.0.
|
|
2718
|
+
var VERSION = true ? "3.0.73" : "0.0.0-test";
|
|
2719
2719
|
|
|
2720
2720
|
// src/xai-video-model.ts
|
|
2721
2721
|
var import_provider6 = require("@ai-sdk/provider");
|
|
@@ -2753,7 +2753,7 @@ var XaiVideoModel = class {
|
|
|
2753
2753
|
return this.config.provider;
|
|
2754
2754
|
}
|
|
2755
2755
|
async doGenerate(options) {
|
|
2756
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2756
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2757
2757
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
2758
2758
|
const warnings = [];
|
|
2759
2759
|
const xaiOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
@@ -2896,7 +2896,13 @@ var XaiVideoModel = class {
|
|
|
2896
2896
|
});
|
|
2897
2897
|
responseHeaders = pollHeaders;
|
|
2898
2898
|
if (statusResponse.status === "done" || statusResponse.status == null && ((_g = statusResponse.video) == null ? void 0 : _g.url)) {
|
|
2899
|
-
if (
|
|
2899
|
+
if (((_h = statusResponse.video) == null ? void 0 : _h.respect_moderation) === false) {
|
|
2900
|
+
throw new import_provider6.AISDKError({
|
|
2901
|
+
name: "XAI_VIDEO_MODERATION_ERROR",
|
|
2902
|
+
message: "Video generation was blocked due to a content policy violation."
|
|
2903
|
+
});
|
|
2904
|
+
}
|
|
2905
|
+
if (!((_i = statusResponse.video) == null ? void 0 : _i.url)) {
|
|
2900
2906
|
throw new import_provider6.AISDKError({
|
|
2901
2907
|
name: "XAI_VIDEO_GENERATION_ERROR",
|
|
2902
2908
|
message: "Video generation completed but no video URL was returned."
|
|
@@ -2920,7 +2926,8 @@ var XaiVideoModel = class {
|
|
|
2920
2926
|
xai: {
|
|
2921
2927
|
requestId,
|
|
2922
2928
|
videoUrl: statusResponse.video.url,
|
|
2923
|
-
...statusResponse.video.duration != null ? { duration: statusResponse.video.duration } : {}
|
|
2929
|
+
...statusResponse.video.duration != null ? { duration: statusResponse.video.duration } : {},
|
|
2930
|
+
...((_j = statusResponse.usage) == null ? void 0 : _j.cost_in_usd_ticks) != null ? { costInUsdTicks: statusResponse.usage.cost_in_usd_ticks } : {}
|
|
2924
2931
|
}
|
|
2925
2932
|
}
|
|
2926
2933
|
};
|
|
@@ -2944,7 +2951,10 @@ var xaiVideoStatusResponseSchema = import_v416.z.object({
|
|
|
2944
2951
|
duration: import_v416.z.number().nullish(),
|
|
2945
2952
|
respect_moderation: import_v416.z.boolean().nullish()
|
|
2946
2953
|
}).nullish(),
|
|
2947
|
-
model: import_v416.z.string().nullish()
|
|
2954
|
+
model: import_v416.z.string().nullish(),
|
|
2955
|
+
usage: import_v416.z.object({
|
|
2956
|
+
cost_in_usd_ticks: import_v416.z.number().nullish()
|
|
2957
|
+
}).nullish()
|
|
2948
2958
|
});
|
|
2949
2959
|
|
|
2950
2960
|
// src/xai-provider.ts
|