@ai-sdk/xai 4.0.41 → 4.0.42
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 +6 -0
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/xai-image-model.ts +7 -0
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1181,6 +1181,11 @@ var XaiImageModel = class _XaiImageModel {
|
|
|
1181
1181
|
abortSignal,
|
|
1182
1182
|
fetch: this.config.fetch
|
|
1183
1183
|
});
|
|
1184
|
+
if (response.data.some((image) => image.respect_moderation === false)) {
|
|
1185
|
+
throw new Error(
|
|
1186
|
+
"Image generation was blocked due to a content policy violation."
|
|
1187
|
+
);
|
|
1188
|
+
}
|
|
1184
1189
|
const hasAllBase64 = response.data.every((image) => image.b64_json != null);
|
|
1185
1190
|
const images = hasAllBase64 ? response.data.map((image) => image.b64_json) : await Promise.all(
|
|
1186
1191
|
response.data.map(
|
|
@@ -1224,7 +1229,8 @@ var xaiImageResponseSchema = z6.object({
|
|
|
1224
1229
|
z6.object({
|
|
1225
1230
|
url: z6.string().nullish(),
|
|
1226
1231
|
b64_json: z6.string().nullish(),
|
|
1227
|
-
revised_prompt: z6.string().nullish()
|
|
1232
|
+
revised_prompt: z6.string().nullish(),
|
|
1233
|
+
respect_moderation: z6.boolean().nullish()
|
|
1228
1234
|
})
|
|
1229
1235
|
),
|
|
1230
1236
|
usage: z6.object({
|
|
@@ -3729,7 +3735,7 @@ var xaiTools = {
|
|
|
3729
3735
|
};
|
|
3730
3736
|
|
|
3731
3737
|
// src/version.ts
|
|
3732
|
-
var VERSION = true ? "4.0.
|
|
3738
|
+
var VERSION = true ? "4.0.42" : "0.0.0-test";
|
|
3733
3739
|
|
|
3734
3740
|
// src/files/xai-files.ts
|
|
3735
3741
|
import {
|