@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.
package/dist/index.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "2.0.80" : "0.0.0-test";
10
+ var VERSION = true ? "2.0.82" : "0.0.0-test";
11
11
 
12
12
  // src/google-generative-ai-embedding-model.ts
13
13
  import {
@@ -695,7 +695,38 @@ var googleGenerativeAIProviderOptions = lazySchema4(
695
695
  "1:4",
696
696
  "4:1"
697
697
  ]).optional(),
698
- imageSize: z4.enum(["1K", "2K", "4K", "512"]).optional()
698
+ imageSize: z4.enum(["1K", "2K", "4K", "512"]).optional(),
699
+ /**
700
+ * Optional. Controls the generation of people in images.
701
+ * Vertex AI only.
702
+ */
703
+ personGeneration: z4.enum([
704
+ "PERSON_GENERATION_UNSPECIFIED",
705
+ "ALLOW_ALL",
706
+ "ALLOW_ADULT",
707
+ "ALLOW_NONE"
708
+ ]).optional(),
709
+ /**
710
+ * Optional. Controls whether generation of prominent people
711
+ * (celebrities) is allowed. When set together with
712
+ * `personGeneration`, `personGeneration` takes precedence.
713
+ * Vertex AI only.
714
+ *
715
+ * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
716
+ */
717
+ prominentPeople: z4.enum([
718
+ "PROMINENT_PEOPLE_UNSPECIFIED",
719
+ "ALLOW_PROMINENT_PEOPLE",
720
+ "BLOCK_PROMINENT_PEOPLE"
721
+ ]).optional(),
722
+ /**
723
+ * Optional. The image output format for generated images.
724
+ * Vertex AI only.
725
+ */
726
+ imageOutputOptions: z4.object({
727
+ mimeType: z4.enum(["image/jpeg", "image/png"]).optional(),
728
+ compressionQuality: z4.number().optional()
729
+ }).optional()
699
730
  }).optional(),
700
731
  /**
701
732
  * Optional. Configuration for grounding retrieval.
@@ -1018,6 +1049,27 @@ var GoogleGenerativeAILanguageModel = class {
1018
1049
  if ((googleOptions == null ? void 0 : googleOptions.serviceTier) && isVertexProvider) {
1019
1050
  sanitizedServiceTier = VertexServiceTierMap[googleOptions.serviceTier];
1020
1051
  }
1052
+ let imageConfig = googleOptions == null ? void 0 : googleOptions.imageConfig;
1053
+ if (imageConfig != null && !isVertexProvider) {
1054
+ const {
1055
+ personGeneration,
1056
+ prominentPeople,
1057
+ imageOutputOptions,
1058
+ ...geminiApiImageConfig
1059
+ } = imageConfig;
1060
+ const droppedImageConfigFields = Object.entries({
1061
+ personGeneration,
1062
+ prominentPeople,
1063
+ imageOutputOptions
1064
+ }).filter(([, value]) => value != null).map(([key]) => `'imageConfig.${key}'`);
1065
+ if (droppedImageConfigFields.length > 0) {
1066
+ warnings.push({
1067
+ type: "other",
1068
+ 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}).`
1069
+ });
1070
+ imageConfig = geminiApiImageConfig;
1071
+ }
1072
+ }
1021
1073
  const safetyThreshold = googleOptions == null ? void 0 : googleOptions.threshold;
1022
1074
  const safetySettings = (_a = googleOptions == null ? void 0 : googleOptions.safetySettings) != null ? _a : safetyThreshold != null ? configurableSafetySettingCategories.map((category) => ({
1023
1075
  category,
@@ -1062,9 +1114,7 @@ var GoogleGenerativeAILanguageModel = class {
1062
1114
  // provider options:
1063
1115
  responseModalities: googleOptions == null ? void 0 : googleOptions.responseModalities,
1064
1116
  thinkingConfig: googleOptions == null ? void 0 : googleOptions.thinkingConfig,
1065
- ...(googleOptions == null ? void 0 : googleOptions.imageConfig) && {
1066
- imageConfig: googleOptions.imageConfig
1067
- },
1117
+ ...imageConfig && { imageConfig },
1068
1118
  ...(googleOptions == null ? void 0 : googleOptions.mediaResolution) && {
1069
1119
  mediaResolution: googleOptions.mediaResolution
1070
1120
  }