@ai-sdk/google 4.0.15 → 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 +12 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +56 -11
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +55 -10
- 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/src/interactions/google-interactions-language-model.ts +2 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 4.0.17
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5b4a299: fix(provider/google): forward Vertex-only imageConfig options (personGeneration, prominentPeople, imageOutputOptions)
|
|
8
|
+
|
|
9
|
+
## 4.0.16
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 662ddfc: Allow google.interactions agent requests to include supported tools, including file_search.
|
|
14
|
+
|
|
3
15
|
## 4.0.15
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
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,
|
|
@@ -6414,12 +6464,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
6414
6464
|
const hasTools = options.tools != null && options.tools.length > 0;
|
|
6415
6465
|
let toolsForBody;
|
|
6416
6466
|
let toolChoiceForBody;
|
|
6417
|
-
if (hasTools
|
|
6418
|
-
warnings.push({
|
|
6419
|
-
type: "other",
|
|
6420
|
-
message: "google.interactions: tools are not supported when an agent is set; tools will be omitted from the request body."
|
|
6421
|
-
});
|
|
6422
|
-
} else if (hasTools) {
|
|
6467
|
+
if (hasTools) {
|
|
6423
6468
|
const prepared = prepareGoogleInteractionsTools({
|
|
6424
6469
|
tools: options.tools,
|
|
6425
6470
|
toolChoice: options.toolChoice
|