@ai-sdk/google 3.0.93 → 3.0.94

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,11 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.94
4
+
5
+ ### Patch Changes
6
+
7
+ - 020836c: fix(provider/google): forward Vertex-only imageConfig options (personGeneration, prominentPeople, imageOutputOptions)
8
+
3
9
  ## 3.0.93
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -32,6 +32,12 @@ declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
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 googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
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_utils23 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/version.ts
33
- var VERSION = true ? "3.0.93" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.94" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -867,7 +867,38 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
867
867
  "1:4",
868
868
  "4:1"
869
869
  ]).optional(),
870
- imageSize: import_v44.z.enum(["1K", "2K", "4K", "512"]).optional()
870
+ imageSize: import_v44.z.enum(["1K", "2K", "4K", "512"]).optional(),
871
+ /**
872
+ * Optional. Controls the generation of people in images.
873
+ * Vertex AI only.
874
+ */
875
+ personGeneration: import_v44.z.enum([
876
+ "PERSON_GENERATION_UNSPECIFIED",
877
+ "ALLOW_ALL",
878
+ "ALLOW_ADULT",
879
+ "ALLOW_NONE"
880
+ ]).optional(),
881
+ /**
882
+ * Optional. Controls whether generation of prominent people
883
+ * (celebrities) is allowed. When set together with
884
+ * `personGeneration`, `personGeneration` takes precedence.
885
+ * Vertex AI only.
886
+ *
887
+ * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
888
+ */
889
+ prominentPeople: import_v44.z.enum([
890
+ "PROMINENT_PEOPLE_UNSPECIFIED",
891
+ "ALLOW_PROMINENT_PEOPLE",
892
+ "BLOCK_PROMINENT_PEOPLE"
893
+ ]).optional(),
894
+ /**
895
+ * Optional. The image output format for generated images.
896
+ * Vertex AI only.
897
+ */
898
+ imageOutputOptions: import_v44.z.object({
899
+ mimeType: import_v44.z.enum(["image/jpeg", "image/png"]).optional(),
900
+ compressionQuality: import_v44.z.number().optional()
901
+ }).optional()
871
902
  }).optional(),
872
903
  /**
873
904
  * Optional. Configuration for grounding retrieval.
@@ -1524,6 +1555,27 @@ var GoogleGenerativeAILanguageModel = class {
1524
1555
  }
1525
1556
  } : void 0;
1526
1557
  const bodyServiceTier = isVertexProvider ? void 0 : googleOptions == null ? void 0 : googleOptions.serviceTier;
1558
+ let imageConfig = googleOptions == null ? void 0 : googleOptions.imageConfig;
1559
+ if (imageConfig != null && !isVertexProvider) {
1560
+ const {
1561
+ personGeneration,
1562
+ prominentPeople,
1563
+ imageOutputOptions,
1564
+ ...geminiApiImageConfig
1565
+ } = imageConfig;
1566
+ const droppedImageConfigFields = Object.entries({
1567
+ personGeneration,
1568
+ prominentPeople,
1569
+ imageOutputOptions
1570
+ }).filter(([, value]) => value != null).map(([key]) => `'imageConfig.${key}'`);
1571
+ if (droppedImageConfigFields.length > 0) {
1572
+ warnings.push({
1573
+ type: "other",
1574
+ 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}).`
1575
+ });
1576
+ imageConfig = geminiApiImageConfig;
1577
+ }
1578
+ }
1527
1579
  const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
1528
1580
  const isGemini3Model = /^gemini-3[.-]/.test(this.modelId);
1529
1581
  const supportsFunctionResponseParts = isGemini3Model;
@@ -1592,9 +1644,7 @@ var GoogleGenerativeAILanguageModel = class {
1592
1644
  ...(googleOptions == null ? void 0 : googleOptions.mediaResolution) && {
1593
1645
  mediaResolution: googleOptions.mediaResolution
1594
1646
  },
1595
- ...(googleOptions == null ? void 0 : googleOptions.imageConfig) && {
1596
- imageConfig: googleOptions.imageConfig
1597
- }
1647
+ ...imageConfig && { imageConfig }
1598
1648
  },
1599
1649
  contents,
1600
1650
  systemInstruction: isGemmaModel ? void 0 : systemInstruction,