@ai-sdk/xai 3.0.71 → 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 +23 -8
- package/dist/index.js +18 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -6
- package/src/xai-video-model.ts +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
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
|
+
|
|
9
|
+
## 3.0.72
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 055cd68: fix: publish v6 to latest npm dist tag
|
|
14
|
+
- Updated dependencies [055cd68]
|
|
15
|
+
- @ai-sdk/openai-compatible@2.0.37
|
|
16
|
+
- @ai-sdk/provider-utils@4.0.21
|
|
17
|
+
|
|
3
18
|
## 3.0.71
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -521,13 +536,13 @@
|
|
|
521
536
|
Before
|
|
522
537
|
|
|
523
538
|
```ts
|
|
524
|
-
model.textEmbeddingModel(
|
|
539
|
+
model.textEmbeddingModel("my-model-id");
|
|
525
540
|
```
|
|
526
541
|
|
|
527
542
|
After
|
|
528
543
|
|
|
529
544
|
```ts
|
|
530
|
-
model.embeddingModel(
|
|
545
|
+
model.embeddingModel("my-model-id");
|
|
531
546
|
```
|
|
532
547
|
|
|
533
548
|
- 2625a04: feat(openai); update spec for mcp approval
|
|
@@ -785,13 +800,13 @@
|
|
|
785
800
|
Before
|
|
786
801
|
|
|
787
802
|
```ts
|
|
788
|
-
model.textEmbeddingModel(
|
|
803
|
+
model.textEmbeddingModel("my-model-id");
|
|
789
804
|
```
|
|
790
805
|
|
|
791
806
|
After
|
|
792
807
|
|
|
793
808
|
```ts
|
|
794
|
-
model.embeddingModel(
|
|
809
|
+
model.embeddingModel("my-model-id");
|
|
795
810
|
```
|
|
796
811
|
|
|
797
812
|
- 8514146: add grok-4-1 model IDs
|
|
@@ -1334,7 +1349,7 @@
|
|
|
1334
1349
|
|
|
1335
1350
|
```js
|
|
1336
1351
|
await generateImage({
|
|
1337
|
-
model: luma.image(
|
|
1352
|
+
model: luma.image("photon-flash-1", {
|
|
1338
1353
|
maxImagesPerCall: 5,
|
|
1339
1354
|
pollIntervalMillis: 500,
|
|
1340
1355
|
}),
|
|
@@ -1347,7 +1362,7 @@
|
|
|
1347
1362
|
|
|
1348
1363
|
```js
|
|
1349
1364
|
await generateImage({
|
|
1350
|
-
model: luma.image(
|
|
1365
|
+
model: luma.image("photon-flash-1"),
|
|
1351
1366
|
prompt,
|
|
1352
1367
|
n: 10,
|
|
1353
1368
|
maxImagesPerCall: 5,
|
|
@@ -1663,7 +1678,7 @@
|
|
|
1663
1678
|
|
|
1664
1679
|
```js
|
|
1665
1680
|
await generateImage({
|
|
1666
|
-
model: luma.image(
|
|
1681
|
+
model: luma.image("photon-flash-1", {
|
|
1667
1682
|
maxImagesPerCall: 5,
|
|
1668
1683
|
pollIntervalMillis: 500,
|
|
1669
1684
|
}),
|
|
@@ -1676,7 +1691,7 @@
|
|
|
1676
1691
|
|
|
1677
1692
|
```js
|
|
1678
1693
|
await generateImage({
|
|
1679
|
-
model: luma.image(
|
|
1694
|
+
model: luma.image("photon-flash-1"),
|
|
1680
1695
|
prompt,
|
|
1681
1696
|
n: 10,
|
|
1682
1697
|
maxImagesPerCall: 5,
|
package/dist/index.js
CHANGED
|
@@ -18,8 +18,8 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
VERSION: () => VERSION,
|
|
24
24
|
codeExecution: () => codeExecution,
|
|
25
25
|
createXai: () => createXai,
|
|
@@ -31,7 +31,7 @@ __export(src_exports, {
|
|
|
31
31
|
xai: () => xai,
|
|
32
32
|
xaiTools: () => xaiTools
|
|
33
33
|
});
|
|
34
|
-
module.exports = __toCommonJS(
|
|
34
|
+
module.exports = __toCommonJS(index_exports);
|
|
35
35
|
|
|
36
36
|
// src/xai-provider.ts
|
|
37
37
|
var import_provider7 = require("@ai-sdk/provider");
|
|
@@ -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
|