@ai-sdk/google 3.0.121 → 3.0.122

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/dist/index.mjs CHANGED
@@ -224,7 +224,7 @@ import {
224
224
  } from "@ai-sdk/provider-utils";
225
225
 
226
226
  // src/version.ts
227
- var VERSION = true ? "3.0.121" : "0.0.0-test";
227
+ var VERSION = true ? "3.0.122" : "0.0.0-test";
228
228
 
229
229
  // src/google-generative-ai-embedding-model.ts
230
230
  import {
@@ -3294,14 +3294,20 @@ var GoogleGenerativeAIImageModel = class {
3294
3294
  abortSignal,
3295
3295
  fetch: this.config.fetch
3296
3296
  });
3297
+ const imagePredictions = response.predictions.filter(
3298
+ (prediction) => "bytesBase64Encoded" in prediction
3299
+ );
3297
3300
  return {
3298
- images: response.predictions.map(
3299
- (p) => p.bytesBase64Encoded
3301
+ images: imagePredictions.map(
3302
+ ({ bytesBase64Encoded }) => bytesBase64Encoded
3300
3303
  ),
3304
+ ...response.predictions.some(
3305
+ (prediction) => "raiFilteredReason" in prediction
3306
+ ) && { isRetryable: false },
3301
3307
  warnings,
3302
3308
  providerMetadata: {
3303
3309
  google: {
3304
- images: response.predictions.map(() => ({
3310
+ images: imagePredictions.map(() => ({
3305
3311
  // Add any prediction-specific metadata here
3306
3312
  }))
3307
3313
  }
@@ -3415,6 +3421,7 @@ var GoogleGenerativeAIImageModel = class {
3415
3421
  const languageModelGoogleMetadata = (_h = (_g = result.providerMetadata) == null ? void 0 : _g.google) != null ? _h : {};
3416
3422
  return {
3417
3423
  images,
3424
+ ...result.finishReason.unified === "content-filter" ? { isRetryable: false } : {},
3418
3425
  warnings,
3419
3426
  providerMetadata: {
3420
3427
  google: {
@@ -3441,7 +3448,12 @@ function isGeminiModel(modelId) {
3441
3448
  var googleImageResponseSchema = lazySchema11(
3442
3449
  () => zodSchema11(
3443
3450
  z15.object({
3444
- predictions: z15.array(z15.object({ bytesBase64Encoded: z15.string() })).default([])
3451
+ predictions: z15.array(
3452
+ z15.union([
3453
+ z15.object({ bytesBase64Encoded: z15.string() }),
3454
+ z15.object({ raiFilteredReason: z15.string() })
3455
+ ])
3456
+ ).default([])
3445
3457
  })
3446
3458
  )
3447
3459
  );