@ai-sdk/google 4.0.16 → 4.0.18

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
+ ## 4.0.18
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [cd06458]
8
+ - @ai-sdk/provider-utils@5.0.11
9
+
10
+ ## 4.0.17
11
+
12
+ ### Patch Changes
13
+
14
+ - 5b4a299: fix(provider/google): forward Vertex-only imageConfig options (personGeneration, prominentPeople, imageOutputOptions)
15
+
3
16
  ## 4.0.16
4
17
 
5
18
  ### Patch Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AI SDK - Google Provider
2
2
 
3
- The **[Google provider](https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for the [Google Generative AI](https://ai.google/discover/generativeai/) APIs.
3
+ The **[Google provider](https://ai-sdk.dev/providers/ai-sdk-providers/google)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for the [Google Generative AI](https://ai.google/discover/generativeai/) APIs.
4
4
 
5
5
  > **Deploying to Vercel?** With Vercel's AI Gateway you can access Google (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).
6
6
 
@@ -42,4 +42,4 @@ const { text } = await generateText({
42
42
 
43
43
  ## Documentation
44
44
 
45
- Please check out the **[Google provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai)** for more information.
45
+ Please check out the **[Google provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/google)** for more information.
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
@@ -7,7 +7,7 @@ import {
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "4.0.16" : "0.0.0-test";
10
+ var VERSION = true ? "4.0.18" : "0.0.0-test";
11
11
 
12
12
  // src/google-embedding-model.ts
13
13
  import {
@@ -983,7 +983,38 @@ var googleLanguageModelOptions = lazySchema4(
983
983
  "1:4",
984
984
  "4:1"
985
985
  ]).optional(),
986
- imageSize: z4.enum(["1K", "2K", "4K", "512"]).optional()
986
+ imageSize: z4.enum(["1K", "2K", "4K", "512"]).optional(),
987
+ /**
988
+ * Optional. Controls the generation of people in images.
989
+ * Vertex AI only.
990
+ */
991
+ personGeneration: z4.enum([
992
+ "PERSON_GENERATION_UNSPECIFIED",
993
+ "ALLOW_ALL",
994
+ "ALLOW_ADULT",
995
+ "ALLOW_NONE"
996
+ ]).optional(),
997
+ /**
998
+ * Optional. Controls whether generation of prominent people
999
+ * (celebrities) is allowed. When set together with
1000
+ * `personGeneration`, `personGeneration` takes precedence.
1001
+ * Vertex AI only.
1002
+ *
1003
+ * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
1004
+ */
1005
+ prominentPeople: z4.enum([
1006
+ "PROMINENT_PEOPLE_UNSPECIFIED",
1007
+ "ALLOW_PROMINENT_PEOPLE",
1008
+ "BLOCK_PROMINENT_PEOPLE"
1009
+ ]).optional(),
1010
+ /**
1011
+ * Optional. The image output format for generated images.
1012
+ * Vertex AI only.
1013
+ */
1014
+ imageOutputOptions: z4.object({
1015
+ mimeType: z4.enum(["image/jpeg", "image/png"]).optional(),
1016
+ compressionQuality: z4.number().optional()
1017
+ }).optional()
987
1018
  }).optional(),
988
1019
  /**
989
1020
  * Optional. Configuration for grounding retrieval.
@@ -1660,6 +1691,27 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1660
1691
  }
1661
1692
  } : void 0;
1662
1693
  const bodyServiceTier = isVertexProvider ? void 0 : googleOptions == null ? void 0 : googleOptions.serviceTier;
1694
+ let imageConfig = googleOptions == null ? void 0 : googleOptions.imageConfig;
1695
+ if (imageConfig != null && !isVertexProvider) {
1696
+ const {
1697
+ personGeneration,
1698
+ prominentPeople,
1699
+ imageOutputOptions,
1700
+ ...geminiApiImageConfig
1701
+ } = imageConfig;
1702
+ const droppedImageConfigFields = Object.entries({
1703
+ personGeneration,
1704
+ prominentPeople,
1705
+ imageOutputOptions
1706
+ }).filter(([, value]) => value != null).map(([key]) => `'imageConfig.${key}'`);
1707
+ if (droppedImageConfigFields.length > 0) {
1708
+ warnings.push({
1709
+ type: "other",
1710
+ 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}).`
1711
+ });
1712
+ imageConfig = geminiApiImageConfig;
1713
+ }
1714
+ }
1663
1715
  const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
1664
1716
  const isGemini3Model2 = /^gemini-3[.-]/.test(this.modelId);
1665
1717
  const supportsFunctionResponseParts = isGemini3Model2;
@@ -1731,9 +1783,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1731
1783
  ...(googleOptions == null ? void 0 : googleOptions.mediaResolution) && {
1732
1784
  mediaResolution: googleOptions.mediaResolution
1733
1785
  },
1734
- ...(googleOptions == null ? void 0 : googleOptions.imageConfig) && {
1735
- imageConfig: googleOptions.imageConfig
1736
- }
1786
+ ...imageConfig && { imageConfig }
1737
1787
  },
1738
1788
  contents,
1739
1789
  systemInstruction: isGemmaModel ? void 0 : systemInstruction,