@ai-sdk/xai 3.0.124 → 3.0.125
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 +9 -0
- package/README.md +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/index.mjs.map +1 -1
- package/docs/01-xai.mdx +10 -10
- package/package.json +6 -6
- package/src/xai-image-model.ts +7 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @ai-sdk/xai
|
|
2
2
|
|
|
3
|
+
## 3.0.125
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f33a407: fix(provider/xai): report image moderation blocks as content policy errors
|
|
8
|
+
- Updated dependencies [2d172fb]
|
|
9
|
+
- @ai-sdk/provider-utils@4.0.47
|
|
10
|
+
- @ai-sdk/openai-compatible@2.0.71
|
|
11
|
+
|
|
3
12
|
## 3.0.124
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1077,6 +1077,11 @@ var XaiImageModel = class {
|
|
|
1077
1077
|
abortSignal,
|
|
1078
1078
|
fetch: this.config.fetch
|
|
1079
1079
|
});
|
|
1080
|
+
if (response.data.some((image) => image.respect_moderation === false)) {
|
|
1081
|
+
throw new Error(
|
|
1082
|
+
"Image generation was blocked due to a content policy violation."
|
|
1083
|
+
);
|
|
1084
|
+
}
|
|
1080
1085
|
const hasAllBase64 = response.data.every((image) => image.b64_json != null);
|
|
1081
1086
|
const images = hasAllBase64 ? response.data.map((image) => image.b64_json) : await Promise.all(
|
|
1082
1087
|
response.data.map(
|
|
@@ -1117,7 +1122,8 @@ var xaiImageResponseSchema = import_v46.z.object({
|
|
|
1117
1122
|
import_v46.z.object({
|
|
1118
1123
|
url: import_v46.z.string().nullish(),
|
|
1119
1124
|
b64_json: import_v46.z.string().nullish(),
|
|
1120
|
-
revised_prompt: import_v46.z.string().nullish()
|
|
1125
|
+
revised_prompt: import_v46.z.string().nullish(),
|
|
1126
|
+
respect_moderation: import_v46.z.boolean().nullish()
|
|
1121
1127
|
})
|
|
1122
1128
|
),
|
|
1123
1129
|
usage: import_v46.z.object({
|
|
@@ -2967,7 +2973,7 @@ var xaiTools = {
|
|
|
2967
2973
|
};
|
|
2968
2974
|
|
|
2969
2975
|
// src/version.ts
|
|
2970
|
-
var VERSION = true ? "3.0.
|
|
2976
|
+
var VERSION = true ? "3.0.125" : "0.0.0-test";
|
|
2971
2977
|
|
|
2972
2978
|
// src/xai-video-model.ts
|
|
2973
2979
|
var import_provider6 = require("@ai-sdk/provider");
|