@ai-sdk/google 2.0.80 → 2.0.82
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 +13 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +55 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +54 -4
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +54 -4
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/internal/index.mjs
CHANGED
|
@@ -486,7 +486,38 @@ var googleGenerativeAIProviderOptions = lazySchema2(
|
|
|
486
486
|
"1:4",
|
|
487
487
|
"4:1"
|
|
488
488
|
]).optional(),
|
|
489
|
-
imageSize: z2.enum(["1K", "2K", "4K", "512"]).optional()
|
|
489
|
+
imageSize: z2.enum(["1K", "2K", "4K", "512"]).optional(),
|
|
490
|
+
/**
|
|
491
|
+
* Optional. Controls the generation of people in images.
|
|
492
|
+
* Vertex AI only.
|
|
493
|
+
*/
|
|
494
|
+
personGeneration: z2.enum([
|
|
495
|
+
"PERSON_GENERATION_UNSPECIFIED",
|
|
496
|
+
"ALLOW_ALL",
|
|
497
|
+
"ALLOW_ADULT",
|
|
498
|
+
"ALLOW_NONE"
|
|
499
|
+
]).optional(),
|
|
500
|
+
/**
|
|
501
|
+
* Optional. Controls whether generation of prominent people
|
|
502
|
+
* (celebrities) is allowed. When set together with
|
|
503
|
+
* `personGeneration`, `personGeneration` takes precedence.
|
|
504
|
+
* Vertex AI only.
|
|
505
|
+
*
|
|
506
|
+
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
|
|
507
|
+
*/
|
|
508
|
+
prominentPeople: z2.enum([
|
|
509
|
+
"PROMINENT_PEOPLE_UNSPECIFIED",
|
|
510
|
+
"ALLOW_PROMINENT_PEOPLE",
|
|
511
|
+
"BLOCK_PROMINENT_PEOPLE"
|
|
512
|
+
]).optional(),
|
|
513
|
+
/**
|
|
514
|
+
* Optional. The image output format for generated images.
|
|
515
|
+
* Vertex AI only.
|
|
516
|
+
*/
|
|
517
|
+
imageOutputOptions: z2.object({
|
|
518
|
+
mimeType: z2.enum(["image/jpeg", "image/png"]).optional(),
|
|
519
|
+
compressionQuality: z2.number().optional()
|
|
520
|
+
}).optional()
|
|
490
521
|
}).optional(),
|
|
491
522
|
/**
|
|
492
523
|
* Optional. Configuration for grounding retrieval.
|
|
@@ -809,6 +840,27 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
809
840
|
if ((googleOptions == null ? void 0 : googleOptions.serviceTier) && isVertexProvider) {
|
|
810
841
|
sanitizedServiceTier = VertexServiceTierMap[googleOptions.serviceTier];
|
|
811
842
|
}
|
|
843
|
+
let imageConfig = googleOptions == null ? void 0 : googleOptions.imageConfig;
|
|
844
|
+
if (imageConfig != null && !isVertexProvider) {
|
|
845
|
+
const {
|
|
846
|
+
personGeneration,
|
|
847
|
+
prominentPeople,
|
|
848
|
+
imageOutputOptions,
|
|
849
|
+
...geminiApiImageConfig
|
|
850
|
+
} = imageConfig;
|
|
851
|
+
const droppedImageConfigFields = Object.entries({
|
|
852
|
+
personGeneration,
|
|
853
|
+
prominentPeople,
|
|
854
|
+
imageOutputOptions
|
|
855
|
+
}).filter(([, value]) => value != null).map(([key]) => `'imageConfig.${key}'`);
|
|
856
|
+
if (droppedImageConfigFields.length > 0) {
|
|
857
|
+
warnings.push({
|
|
858
|
+
type: "other",
|
|
859
|
+
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}).`
|
|
860
|
+
});
|
|
861
|
+
imageConfig = geminiApiImageConfig;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
812
864
|
const safetyThreshold = googleOptions == null ? void 0 : googleOptions.threshold;
|
|
813
865
|
const safetySettings = (_a = googleOptions == null ? void 0 : googleOptions.safetySettings) != null ? _a : safetyThreshold != null ? configurableSafetySettingCategories.map((category) => ({
|
|
814
866
|
category,
|
|
@@ -853,9 +905,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
853
905
|
// provider options:
|
|
854
906
|
responseModalities: googleOptions == null ? void 0 : googleOptions.responseModalities,
|
|
855
907
|
thinkingConfig: googleOptions == null ? void 0 : googleOptions.thinkingConfig,
|
|
856
|
-
...
|
|
857
|
-
imageConfig: googleOptions.imageConfig
|
|
858
|
-
},
|
|
908
|
+
...imageConfig && { imageConfig },
|
|
859
909
|
...(googleOptions == null ? void 0 : googleOptions.mediaResolution) && {
|
|
860
910
|
mediaResolution: googleOptions.mediaResolution
|
|
861
911
|
}
|