@ai-sdk/google 3.0.92 → 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 +12 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +56 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -11
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +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/dist/internal/index.mjs +55 -10
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/google-generative-ai-language-model.ts +30 -3
- package/src/google-generative-ai-options.ts +40 -0
- package/src/interactions/google-interactions-language-model.ts +2 -8
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "3.0.
|
|
10
|
+
var VERSION = true ? "3.0.94" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -876,7 +876,38 @@ var googleLanguageModelOptions = lazySchema4(
|
|
|
876
876
|
"1:4",
|
|
877
877
|
"4:1"
|
|
878
878
|
]).optional(),
|
|
879
|
-
imageSize: z4.enum(["1K", "2K", "4K", "512"]).optional()
|
|
879
|
+
imageSize: z4.enum(["1K", "2K", "4K", "512"]).optional(),
|
|
880
|
+
/**
|
|
881
|
+
* Optional. Controls the generation of people in images.
|
|
882
|
+
* Vertex AI only.
|
|
883
|
+
*/
|
|
884
|
+
personGeneration: z4.enum([
|
|
885
|
+
"PERSON_GENERATION_UNSPECIFIED",
|
|
886
|
+
"ALLOW_ALL",
|
|
887
|
+
"ALLOW_ADULT",
|
|
888
|
+
"ALLOW_NONE"
|
|
889
|
+
]).optional(),
|
|
890
|
+
/**
|
|
891
|
+
* Optional. Controls whether generation of prominent people
|
|
892
|
+
* (celebrities) is allowed. When set together with
|
|
893
|
+
* `personGeneration`, `personGeneration` takes precedence.
|
|
894
|
+
* Vertex AI only.
|
|
895
|
+
*
|
|
896
|
+
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
|
|
897
|
+
*/
|
|
898
|
+
prominentPeople: z4.enum([
|
|
899
|
+
"PROMINENT_PEOPLE_UNSPECIFIED",
|
|
900
|
+
"ALLOW_PROMINENT_PEOPLE",
|
|
901
|
+
"BLOCK_PROMINENT_PEOPLE"
|
|
902
|
+
]).optional(),
|
|
903
|
+
/**
|
|
904
|
+
* Optional. The image output format for generated images.
|
|
905
|
+
* Vertex AI only.
|
|
906
|
+
*/
|
|
907
|
+
imageOutputOptions: z4.object({
|
|
908
|
+
mimeType: z4.enum(["image/jpeg", "image/png"]).optional(),
|
|
909
|
+
compressionQuality: z4.number().optional()
|
|
910
|
+
}).optional()
|
|
880
911
|
}).optional(),
|
|
881
912
|
/**
|
|
882
913
|
* Optional. Configuration for grounding retrieval.
|
|
@@ -1535,6 +1566,27 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1535
1566
|
}
|
|
1536
1567
|
} : void 0;
|
|
1537
1568
|
const bodyServiceTier = isVertexProvider ? void 0 : googleOptions == null ? void 0 : googleOptions.serviceTier;
|
|
1569
|
+
let imageConfig = googleOptions == null ? void 0 : googleOptions.imageConfig;
|
|
1570
|
+
if (imageConfig != null && !isVertexProvider) {
|
|
1571
|
+
const {
|
|
1572
|
+
personGeneration,
|
|
1573
|
+
prominentPeople,
|
|
1574
|
+
imageOutputOptions,
|
|
1575
|
+
...geminiApiImageConfig
|
|
1576
|
+
} = imageConfig;
|
|
1577
|
+
const droppedImageConfigFields = Object.entries({
|
|
1578
|
+
personGeneration,
|
|
1579
|
+
prominentPeople,
|
|
1580
|
+
imageOutputOptions
|
|
1581
|
+
}).filter(([, value]) => value != null).map(([key]) => `'imageConfig.${key}'`);
|
|
1582
|
+
if (droppedImageConfigFields.length > 0) {
|
|
1583
|
+
warnings.push({
|
|
1584
|
+
type: "other",
|
|
1585
|
+
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}).`
|
|
1586
|
+
});
|
|
1587
|
+
imageConfig = geminiApiImageConfig;
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1538
1590
|
const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
|
|
1539
1591
|
const isGemini3Model = /^gemini-3[.-]/.test(this.modelId);
|
|
1540
1592
|
const supportsFunctionResponseParts = isGemini3Model;
|
|
@@ -1603,9 +1655,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1603
1655
|
...(googleOptions == null ? void 0 : googleOptions.mediaResolution) && {
|
|
1604
1656
|
mediaResolution: googleOptions.mediaResolution
|
|
1605
1657
|
},
|
|
1606
|
-
...
|
|
1607
|
-
imageConfig: googleOptions.imageConfig
|
|
1608
|
-
}
|
|
1658
|
+
...imageConfig && { imageConfig }
|
|
1609
1659
|
},
|
|
1610
1660
|
contents,
|
|
1611
1661
|
systemInstruction: isGemmaModel ? void 0 : systemInstruction,
|
|
@@ -5778,12 +5828,7 @@ var GoogleInteractionsLanguageModel = class {
|
|
|
5778
5828
|
const hasTools = options.tools != null && options.tools.length > 0;
|
|
5779
5829
|
let toolsForBody;
|
|
5780
5830
|
let toolChoiceForBody;
|
|
5781
|
-
if (hasTools
|
|
5782
|
-
warnings.push({
|
|
5783
|
-
type: "other",
|
|
5784
|
-
message: "google.interactions: tools are not supported when an agent is set; tools will be omitted from the request body."
|
|
5785
|
-
});
|
|
5786
|
-
} else if (hasTools) {
|
|
5831
|
+
if (hasTools) {
|
|
5787
5832
|
const prepared = prepareGoogleInteractionsTools({
|
|
5788
5833
|
tools: options.tools,
|
|
5789
5834
|
toolChoice: options.toolChoice
|