@ai-sdk/google 2.0.80 → 2.0.82

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.
@@ -496,7 +496,38 @@ var googleGenerativeAIProviderOptions = (0, import_provider_utils3.lazySchema)(
496
496
  "1:4",
497
497
  "4:1"
498
498
  ]).optional(),
499
- imageSize: import_v42.z.enum(["1K", "2K", "4K", "512"]).optional()
499
+ imageSize: import_v42.z.enum(["1K", "2K", "4K", "512"]).optional(),
500
+ /**
501
+ * Optional. Controls the generation of people in images.
502
+ * Vertex AI only.
503
+ */
504
+ personGeneration: import_v42.z.enum([
505
+ "PERSON_GENERATION_UNSPECIFIED",
506
+ "ALLOW_ALL",
507
+ "ALLOW_ADULT",
508
+ "ALLOW_NONE"
509
+ ]).optional(),
510
+ /**
511
+ * Optional. Controls whether generation of prominent people
512
+ * (celebrities) is allowed. When set together with
513
+ * `personGeneration`, `personGeneration` takes precedence.
514
+ * Vertex AI only.
515
+ *
516
+ * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
517
+ */
518
+ prominentPeople: import_v42.z.enum([
519
+ "PROMINENT_PEOPLE_UNSPECIFIED",
520
+ "ALLOW_PROMINENT_PEOPLE",
521
+ "BLOCK_PROMINENT_PEOPLE"
522
+ ]).optional(),
523
+ /**
524
+ * Optional. The image output format for generated images.
525
+ * Vertex AI only.
526
+ */
527
+ imageOutputOptions: import_v42.z.object({
528
+ mimeType: import_v42.z.enum(["image/jpeg", "image/png"]).optional(),
529
+ compressionQuality: import_v42.z.number().optional()
530
+ }).optional()
500
531
  }).optional(),
501
532
  /**
502
533
  * Optional. Configuration for grounding retrieval.
@@ -817,6 +848,27 @@ var GoogleGenerativeAILanguageModel = class {
817
848
  if ((googleOptions == null ? void 0 : googleOptions.serviceTier) && isVertexProvider) {
818
849
  sanitizedServiceTier = VertexServiceTierMap[googleOptions.serviceTier];
819
850
  }
851
+ let imageConfig = googleOptions == null ? void 0 : googleOptions.imageConfig;
852
+ if (imageConfig != null && !isVertexProvider) {
853
+ const {
854
+ personGeneration,
855
+ prominentPeople,
856
+ imageOutputOptions,
857
+ ...geminiApiImageConfig
858
+ } = imageConfig;
859
+ const droppedImageConfigFields = Object.entries({
860
+ personGeneration,
861
+ prominentPeople,
862
+ imageOutputOptions
863
+ }).filter(([, value]) => value != null).map(([key]) => `'imageConfig.${key}'`);
864
+ if (droppedImageConfigFields.length > 0) {
865
+ warnings.push({
866
+ type: "other",
867
+ 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}).`
868
+ });
869
+ imageConfig = geminiApiImageConfig;
870
+ }
871
+ }
820
872
  const safetyThreshold = googleOptions == null ? void 0 : googleOptions.threshold;
821
873
  const safetySettings = (_a = googleOptions == null ? void 0 : googleOptions.safetySettings) != null ? _a : safetyThreshold != null ? configurableSafetySettingCategories.map((category) => ({
822
874
  category,
@@ -861,9 +913,7 @@ var GoogleGenerativeAILanguageModel = class {
861
913
  // provider options:
862
914
  responseModalities: googleOptions == null ? void 0 : googleOptions.responseModalities,
863
915
  thinkingConfig: googleOptions == null ? void 0 : googleOptions.thinkingConfig,
864
- ...(googleOptions == null ? void 0 : googleOptions.imageConfig) && {
865
- imageConfig: googleOptions.imageConfig
866
- },
916
+ ...imageConfig && { imageConfig },
867
917
  ...(googleOptions == null ? void 0 : googleOptions.mediaResolution) && {
868
918
  mediaResolution: googleOptions.mediaResolution
869
919
  }