@ai-sdk/google 4.0.16 → 4.0.17

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.
@@ -754,7 +754,38 @@ var googleLanguageModelOptions = lazySchema2(
754
754
  "1:4",
755
755
  "4:1"
756
756
  ]).optional(),
757
- imageSize: z2.enum(["1K", "2K", "4K", "512"]).optional()
757
+ imageSize: z2.enum(["1K", "2K", "4K", "512"]).optional(),
758
+ /**
759
+ * Optional. Controls the generation of people in images.
760
+ * Vertex AI only.
761
+ */
762
+ personGeneration: z2.enum([
763
+ "PERSON_GENERATION_UNSPECIFIED",
764
+ "ALLOW_ALL",
765
+ "ALLOW_ADULT",
766
+ "ALLOW_NONE"
767
+ ]).optional(),
768
+ /**
769
+ * Optional. Controls whether generation of prominent people
770
+ * (celebrities) is allowed. When set together with
771
+ * `personGeneration`, `personGeneration` takes precedence.
772
+ * Vertex AI only.
773
+ *
774
+ * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
775
+ */
776
+ prominentPeople: z2.enum([
777
+ "PROMINENT_PEOPLE_UNSPECIFIED",
778
+ "ALLOW_PROMINENT_PEOPLE",
779
+ "BLOCK_PROMINENT_PEOPLE"
780
+ ]).optional(),
781
+ /**
782
+ * Optional. The image output format for generated images.
783
+ * Vertex AI only.
784
+ */
785
+ imageOutputOptions: z2.object({
786
+ mimeType: z2.enum(["image/jpeg", "image/png"]).optional(),
787
+ compressionQuality: z2.number().optional()
788
+ }).optional()
758
789
  }).optional(),
759
790
  /**
760
791
  * Optional. Configuration for grounding retrieval.
@@ -1431,6 +1462,27 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1431
1462
  }
1432
1463
  } : void 0;
1433
1464
  const bodyServiceTier = isVertexProvider ? void 0 : googleOptions == null ? void 0 : googleOptions.serviceTier;
1465
+ let imageConfig = googleOptions == null ? void 0 : googleOptions.imageConfig;
1466
+ if (imageConfig != null && !isVertexProvider) {
1467
+ const {
1468
+ personGeneration,
1469
+ prominentPeople,
1470
+ imageOutputOptions,
1471
+ ...geminiApiImageConfig
1472
+ } = imageConfig;
1473
+ const droppedImageConfigFields = Object.entries({
1474
+ personGeneration,
1475
+ prominentPeople,
1476
+ imageOutputOptions
1477
+ }).filter(([, value]) => value != null).map(([key]) => `'imageConfig.${key}'`);
1478
+ if (droppedImageConfigFields.length > 0) {
1479
+ warnings.push({
1480
+ type: "other",
1481
+ message: `${droppedImageConfigFields.join(", ")} ${droppedImageConfigFields.length === 1 ? "is a Vertex AI option and is" : "are Vertex AI options and are"} ignored with the current Google provider (${this.config.provider}).`
1482
+ });
1483
+ imageConfig = geminiApiImageConfig;
1484
+ }
1485
+ }
1434
1486
  const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
1435
1487
  const isGemini3Model2 = /^gemini-3[.-]/.test(this.modelId);
1436
1488
  const supportsFunctionResponseParts = isGemini3Model2;
@@ -1502,9 +1554,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1502
1554
  ...(googleOptions == null ? void 0 : googleOptions.mediaResolution) && {
1503
1555
  mediaResolution: googleOptions.mediaResolution
1504
1556
  },
1505
- ...(googleOptions == null ? void 0 : googleOptions.imageConfig) && {
1506
- imageConfig: googleOptions.imageConfig
1507
- }
1557
+ ...imageConfig && { imageConfig }
1508
1558
  },
1509
1559
  contents,
1510
1560
  systemInstruction: isGemmaModel ? void 0 : systemInstruction,