@ai-sdk/google 2.0.79 → 2.0.81

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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 2.0.81
4
+
5
+ ### Patch Changes
6
+
7
+ - c6552b9: fix(provider/google): forward Vertex-only imageConfig options (personGeneration, prominentPeople, imageOutputOptions)
8
+
9
+ ## 2.0.80
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [c6e1d1a]
14
+ - @ai-sdk/provider-utils@3.0.29
15
+
3
16
  ## 2.0.79
4
17
 
5
18
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -32,6 +32,12 @@ declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySche
32
32
  imageConfig?: {
33
33
  aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "1:8" | "8:1" | "1:4" | "4:1" | undefined;
34
34
  imageSize?: "1K" | "2K" | "4K" | "512" | undefined;
35
+ personGeneration?: "PERSON_GENERATION_UNSPECIFIED" | "ALLOW_ALL" | "ALLOW_ADULT" | "ALLOW_NONE" | undefined;
36
+ prominentPeople?: "PROMINENT_PEOPLE_UNSPECIFIED" | "ALLOW_PROMINENT_PEOPLE" | "BLOCK_PROMINENT_PEOPLE" | undefined;
37
+ imageOutputOptions?: {
38
+ mimeType?: "image/jpeg" | "image/png" | undefined;
39
+ compressionQuality?: number | undefined;
40
+ } | undefined;
35
41
  } | undefined;
36
42
  retrievalConfig?: {
37
43
  latLng?: {
package/dist/index.d.ts CHANGED
@@ -32,6 +32,12 @@ declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySche
32
32
  imageConfig?: {
33
33
  aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "1:8" | "8:1" | "1:4" | "4:1" | undefined;
34
34
  imageSize?: "1K" | "2K" | "4K" | "512" | undefined;
35
+ personGeneration?: "PERSON_GENERATION_UNSPECIFIED" | "ALLOW_ALL" | "ALLOW_ADULT" | "ALLOW_NONE" | undefined;
36
+ prominentPeople?: "PROMINENT_PEOPLE_UNSPECIFIED" | "ALLOW_PROMINENT_PEOPLE" | "BLOCK_PROMINENT_PEOPLE" | undefined;
37
+ imageOutputOptions?: {
38
+ mimeType?: "image/jpeg" | "image/png" | undefined;
39
+ compressionQuality?: number | undefined;
40
+ } | undefined;
35
41
  } | undefined;
36
42
  retrievalConfig?: {
37
43
  latLng?: {
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
30
30
  var import_provider_utils15 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/version.ts
33
- var VERSION = true ? "2.0.79" : "0.0.0-test";
33
+ var VERSION = true ? "2.0.81" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -686,7 +686,38 @@ var googleGenerativeAIProviderOptions = (0, import_provider_utils5.lazySchema)(
686
686
  "1:4",
687
687
  "4:1"
688
688
  ]).optional(),
689
- imageSize: import_v44.z.enum(["1K", "2K", "4K", "512"]).optional()
689
+ imageSize: import_v44.z.enum(["1K", "2K", "4K", "512"]).optional(),
690
+ /**
691
+ * Optional. Controls the generation of people in images.
692
+ * Vertex AI only.
693
+ */
694
+ personGeneration: import_v44.z.enum([
695
+ "PERSON_GENERATION_UNSPECIFIED",
696
+ "ALLOW_ALL",
697
+ "ALLOW_ADULT",
698
+ "ALLOW_NONE"
699
+ ]).optional(),
700
+ /**
701
+ * Optional. Controls whether generation of prominent people
702
+ * (celebrities) is allowed. When set together with
703
+ * `personGeneration`, `personGeneration` takes precedence.
704
+ * Vertex AI only.
705
+ *
706
+ * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
707
+ */
708
+ prominentPeople: import_v44.z.enum([
709
+ "PROMINENT_PEOPLE_UNSPECIFIED",
710
+ "ALLOW_PROMINENT_PEOPLE",
711
+ "BLOCK_PROMINENT_PEOPLE"
712
+ ]).optional(),
713
+ /**
714
+ * Optional. The image output format for generated images.
715
+ * Vertex AI only.
716
+ */
717
+ imageOutputOptions: import_v44.z.object({
718
+ mimeType: import_v44.z.enum(["image/jpeg", "image/png"]).optional(),
719
+ compressionQuality: import_v44.z.number().optional()
720
+ }).optional()
690
721
  }).optional(),
691
722
  /**
692
723
  * Optional. Configuration for grounding retrieval.
@@ -1007,6 +1038,27 @@ var GoogleGenerativeAILanguageModel = class {
1007
1038
  if ((googleOptions == null ? void 0 : googleOptions.serviceTier) && isVertexProvider) {
1008
1039
  sanitizedServiceTier = VertexServiceTierMap[googleOptions.serviceTier];
1009
1040
  }
1041
+ let imageConfig = googleOptions == null ? void 0 : googleOptions.imageConfig;
1042
+ if (imageConfig != null && !isVertexProvider) {
1043
+ const {
1044
+ personGeneration,
1045
+ prominentPeople,
1046
+ imageOutputOptions,
1047
+ ...geminiApiImageConfig
1048
+ } = imageConfig;
1049
+ const droppedImageConfigFields = Object.entries({
1050
+ personGeneration,
1051
+ prominentPeople,
1052
+ imageOutputOptions
1053
+ }).filter(([, value]) => value != null).map(([key]) => `'imageConfig.${key}'`);
1054
+ if (droppedImageConfigFields.length > 0) {
1055
+ warnings.push({
1056
+ type: "other",
1057
+ 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}).`
1058
+ });
1059
+ imageConfig = geminiApiImageConfig;
1060
+ }
1061
+ }
1010
1062
  const safetyThreshold = googleOptions == null ? void 0 : googleOptions.threshold;
1011
1063
  const safetySettings = (_a = googleOptions == null ? void 0 : googleOptions.safetySettings) != null ? _a : safetyThreshold != null ? configurableSafetySettingCategories.map((category) => ({
1012
1064
  category,
@@ -1051,9 +1103,7 @@ var GoogleGenerativeAILanguageModel = class {
1051
1103
  // provider options:
1052
1104
  responseModalities: googleOptions == null ? void 0 : googleOptions.responseModalities,
1053
1105
  thinkingConfig: googleOptions == null ? void 0 : googleOptions.thinkingConfig,
1054
- ...(googleOptions == null ? void 0 : googleOptions.imageConfig) && {
1055
- imageConfig: googleOptions.imageConfig
1056
- },
1106
+ ...imageConfig && { imageConfig },
1057
1107
  ...(googleOptions == null ? void 0 : googleOptions.mediaResolution) && {
1058
1108
  mediaResolution: googleOptions.mediaResolution
1059
1109
  }