@ai-sdk/xai 4.0.0-beta.10 → 4.0.0-beta.12
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 +19 -0
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/responses/convert-to-xai-responses-input.ts +1 -0
- package/src/xai-video-model.ts +16 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
+
## 4.0.0-beta.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d20829e: feat(provider/xai): add moderation error, and costInUsdTicks to video model
|
|
8
|
+
- Updated dependencies [61753c3]
|
|
9
|
+
- @ai-sdk/provider-utils@5.0.0-beta.4
|
|
10
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.6
|
|
11
|
+
|
|
12
|
+
## 4.0.0-beta.11
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- f7d4f01: feat(provider): add support for `reasoning-file` type for files that are part of reasoning
|
|
17
|
+
- Updated dependencies [f7d4f01]
|
|
18
|
+
- @ai-sdk/provider-utils@5.0.0-beta.3
|
|
19
|
+
- @ai-sdk/provider@4.0.0-beta.2
|
|
20
|
+
- @ai-sdk/openai-compatible@3.0.0-beta.5
|
|
21
|
+
|
|
3
22
|
## 4.0.0-beta.10
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -1130,6 +1130,7 @@ async function convertToXaiResponsesInput({
|
|
|
1130
1130
|
break;
|
|
1131
1131
|
}
|
|
1132
1132
|
case "reasoning":
|
|
1133
|
+
case "reasoning-file":
|
|
1133
1134
|
case "file": {
|
|
1134
1135
|
inputWarnings.push({
|
|
1135
1136
|
type: "other",
|
|
@@ -2724,7 +2725,7 @@ var xaiTools = {
|
|
|
2724
2725
|
};
|
|
2725
2726
|
|
|
2726
2727
|
// src/version.ts
|
|
2727
|
-
var VERSION = true ? "4.0.0-beta.
|
|
2728
|
+
var VERSION = true ? "4.0.0-beta.12" : "0.0.0-test";
|
|
2728
2729
|
|
|
2729
2730
|
// src/xai-video-model.ts
|
|
2730
2731
|
var import_provider6 = require("@ai-sdk/provider");
|
|
@@ -2762,7 +2763,7 @@ var XaiVideoModel = class {
|
|
|
2762
2763
|
return this.config.provider;
|
|
2763
2764
|
}
|
|
2764
2765
|
async doGenerate(options) {
|
|
2765
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2766
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2766
2767
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
2767
2768
|
const warnings = [];
|
|
2768
2769
|
const xaiOptions = await (0, import_provider_utils16.parseProviderOptions)({
|
|
@@ -2905,7 +2906,13 @@ var XaiVideoModel = class {
|
|
|
2905
2906
|
});
|
|
2906
2907
|
responseHeaders = pollHeaders;
|
|
2907
2908
|
if (statusResponse.status === "done" || statusResponse.status == null && ((_g = statusResponse.video) == null ? void 0 : _g.url)) {
|
|
2908
|
-
if (
|
|
2909
|
+
if (((_h = statusResponse.video) == null ? void 0 : _h.respect_moderation) === false) {
|
|
2910
|
+
throw new import_provider6.AISDKError({
|
|
2911
|
+
name: "XAI_VIDEO_MODERATION_ERROR",
|
|
2912
|
+
message: "Video generation was blocked due to a content policy violation."
|
|
2913
|
+
});
|
|
2914
|
+
}
|
|
2915
|
+
if (!((_i = statusResponse.video) == null ? void 0 : _i.url)) {
|
|
2909
2916
|
throw new import_provider6.AISDKError({
|
|
2910
2917
|
name: "XAI_VIDEO_GENERATION_ERROR",
|
|
2911
2918
|
message: "Video generation completed but no video URL was returned."
|
|
@@ -2929,7 +2936,8 @@ var XaiVideoModel = class {
|
|
|
2929
2936
|
xai: {
|
|
2930
2937
|
requestId,
|
|
2931
2938
|
videoUrl: statusResponse.video.url,
|
|
2932
|
-
...statusResponse.video.duration != null ? { duration: statusResponse.video.duration } : {}
|
|
2939
|
+
...statusResponse.video.duration != null ? { duration: statusResponse.video.duration } : {},
|
|
2940
|
+
...((_j = statusResponse.usage) == null ? void 0 : _j.cost_in_usd_ticks) != null ? { costInUsdTicks: statusResponse.usage.cost_in_usd_ticks } : {}
|
|
2933
2941
|
}
|
|
2934
2942
|
}
|
|
2935
2943
|
};
|
|
@@ -2953,7 +2961,10 @@ var xaiVideoStatusResponseSchema = import_v416.z.object({
|
|
|
2953
2961
|
duration: import_v416.z.number().nullish(),
|
|
2954
2962
|
respect_moderation: import_v416.z.boolean().nullish()
|
|
2955
2963
|
}).nullish(),
|
|
2956
|
-
model: import_v416.z.string().nullish()
|
|
2964
|
+
model: import_v416.z.string().nullish(),
|
|
2965
|
+
usage: import_v416.z.object({
|
|
2966
|
+
cost_in_usd_ticks: import_v416.z.number().nullish()
|
|
2967
|
+
}).nullish()
|
|
2957
2968
|
});
|
|
2958
2969
|
|
|
2959
2970
|
// src/xai-provider.ts
|