@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/dist/index.mjs
CHANGED
|
@@ -2736,7 +2736,7 @@ var xaiTools = {
|
|
|
2736
2736
|
};
|
|
2737
2737
|
|
|
2738
2738
|
// src/version.ts
|
|
2739
|
-
var VERSION = true ? "3.0.
|
|
2739
|
+
var VERSION = true ? "3.0.73" : "0.0.0-test";
|
|
2740
2740
|
|
|
2741
2741
|
// src/xai-video-model.ts
|
|
2742
2742
|
import {
|
|
@@ -2784,7 +2784,7 @@ var XaiVideoModel = class {
|
|
|
2784
2784
|
return this.config.provider;
|
|
2785
2785
|
}
|
|
2786
2786
|
async doGenerate(options) {
|
|
2787
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2787
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2788
2788
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
2789
2789
|
const warnings = [];
|
|
2790
2790
|
const xaiOptions = await parseProviderOptions4({
|
|
@@ -2927,7 +2927,13 @@ var XaiVideoModel = class {
|
|
|
2927
2927
|
});
|
|
2928
2928
|
responseHeaders = pollHeaders;
|
|
2929
2929
|
if (statusResponse.status === "done" || statusResponse.status == null && ((_g = statusResponse.video) == null ? void 0 : _g.url)) {
|
|
2930
|
-
if (
|
|
2930
|
+
if (((_h = statusResponse.video) == null ? void 0 : _h.respect_moderation) === false) {
|
|
2931
|
+
throw new AISDKError({
|
|
2932
|
+
name: "XAI_VIDEO_MODERATION_ERROR",
|
|
2933
|
+
message: "Video generation was blocked due to a content policy violation."
|
|
2934
|
+
});
|
|
2935
|
+
}
|
|
2936
|
+
if (!((_i = statusResponse.video) == null ? void 0 : _i.url)) {
|
|
2931
2937
|
throw new AISDKError({
|
|
2932
2938
|
name: "XAI_VIDEO_GENERATION_ERROR",
|
|
2933
2939
|
message: "Video generation completed but no video URL was returned."
|
|
@@ -2951,7 +2957,8 @@ var XaiVideoModel = class {
|
|
|
2951
2957
|
xai: {
|
|
2952
2958
|
requestId,
|
|
2953
2959
|
videoUrl: statusResponse.video.url,
|
|
2954
|
-
...statusResponse.video.duration != null ? { duration: statusResponse.video.duration } : {}
|
|
2960
|
+
...statusResponse.video.duration != null ? { duration: statusResponse.video.duration } : {},
|
|
2961
|
+
...((_j = statusResponse.usage) == null ? void 0 : _j.cost_in_usd_ticks) != null ? { costInUsdTicks: statusResponse.usage.cost_in_usd_ticks } : {}
|
|
2955
2962
|
}
|
|
2956
2963
|
}
|
|
2957
2964
|
};
|
|
@@ -2975,7 +2982,10 @@ var xaiVideoStatusResponseSchema = z16.object({
|
|
|
2975
2982
|
duration: z16.number().nullish(),
|
|
2976
2983
|
respect_moderation: z16.boolean().nullish()
|
|
2977
2984
|
}).nullish(),
|
|
2978
|
-
model: z16.string().nullish()
|
|
2985
|
+
model: z16.string().nullish(),
|
|
2986
|
+
usage: z16.object({
|
|
2987
|
+
cost_in_usd_ticks: z16.number().nullish()
|
|
2988
|
+
}).nullish()
|
|
2979
2989
|
});
|
|
2980
2990
|
|
|
2981
2991
|
// src/xai-provider.ts
|