@ai-sdk/google 4.0.16 → 4.0.17
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 +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +55 -5
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +54 -4
- package/dist/internal/index.js.map +1 -1
- package/package.json +1 -1
- package/src/google-language-model-options.ts +40 -0
- package/src/google-language-model.ts +30 -3
package/CHANGELOG.md
CHANGED
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.
|
|
10
|
+
var VERSION = true ? "4.0.17" : "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
|
-
...
|
|
1735
|
-
imageConfig: googleOptions.imageConfig
|
|
1736
|
-
}
|
|
1786
|
+
...imageConfig && { imageConfig }
|
|
1737
1787
|
},
|
|
1738
1788
|
contents,
|
|
1739
1789
|
systemInstruction: isGemmaModel ? void 0 : systemInstruction,
|