@ai-sdk/google 3.0.93 → 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 +6 -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 +1 -1
- package/src/google-generative-ai-language-model.ts +30 -3
- package/src/google-generative-ai-options.ts +40 -0
package/dist/internal/index.mjs
CHANGED
|
@@ -659,7 +659,38 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
659
659
|
"1:4",
|
|
660
660
|
"4:1"
|
|
661
661
|
]).optional(),
|
|
662
|
-
imageSize: z2.enum(["1K", "2K", "4K", "512"]).optional()
|
|
662
|
+
imageSize: z2.enum(["1K", "2K", "4K", "512"]).optional(),
|
|
663
|
+
/**
|
|
664
|
+
* Optional. Controls the generation of people in images.
|
|
665
|
+
* Vertex AI only.
|
|
666
|
+
*/
|
|
667
|
+
personGeneration: z2.enum([
|
|
668
|
+
"PERSON_GENERATION_UNSPECIFIED",
|
|
669
|
+
"ALLOW_ALL",
|
|
670
|
+
"ALLOW_ADULT",
|
|
671
|
+
"ALLOW_NONE"
|
|
672
|
+
]).optional(),
|
|
673
|
+
/**
|
|
674
|
+
* Optional. Controls whether generation of prominent people
|
|
675
|
+
* (celebrities) is allowed. When set together with
|
|
676
|
+
* `personGeneration`, `personGeneration` takes precedence.
|
|
677
|
+
* Vertex AI only.
|
|
678
|
+
*
|
|
679
|
+
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
|
|
680
|
+
*/
|
|
681
|
+
prominentPeople: z2.enum([
|
|
682
|
+
"PROMINENT_PEOPLE_UNSPECIFIED",
|
|
683
|
+
"ALLOW_PROMINENT_PEOPLE",
|
|
684
|
+
"BLOCK_PROMINENT_PEOPLE"
|
|
685
|
+
]).optional(),
|
|
686
|
+
/**
|
|
687
|
+
* Optional. The image output format for generated images.
|
|
688
|
+
* Vertex AI only.
|
|
689
|
+
*/
|
|
690
|
+
imageOutputOptions: z2.object({
|
|
691
|
+
mimeType: z2.enum(["image/jpeg", "image/png"]).optional(),
|
|
692
|
+
compressionQuality: z2.number().optional()
|
|
693
|
+
}).optional()
|
|
663
694
|
}).optional(),
|
|
664
695
|
/**
|
|
665
696
|
* Optional. Configuration for grounding retrieval.
|
|
@@ -1318,6 +1349,27 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1318
1349
|
}
|
|
1319
1350
|
} : void 0;
|
|
1320
1351
|
const bodyServiceTier = isVertexProvider ? void 0 : googleOptions == null ? void 0 : googleOptions.serviceTier;
|
|
1352
|
+
let imageConfig = googleOptions == null ? void 0 : googleOptions.imageConfig;
|
|
1353
|
+
if (imageConfig != null && !isVertexProvider) {
|
|
1354
|
+
const {
|
|
1355
|
+
personGeneration,
|
|
1356
|
+
prominentPeople,
|
|
1357
|
+
imageOutputOptions,
|
|
1358
|
+
...geminiApiImageConfig
|
|
1359
|
+
} = imageConfig;
|
|
1360
|
+
const droppedImageConfigFields = Object.entries({
|
|
1361
|
+
personGeneration,
|
|
1362
|
+
prominentPeople,
|
|
1363
|
+
imageOutputOptions
|
|
1364
|
+
}).filter(([, value]) => value != null).map(([key]) => `'imageConfig.${key}'`);
|
|
1365
|
+
if (droppedImageConfigFields.length > 0) {
|
|
1366
|
+
warnings.push({
|
|
1367
|
+
type: "other",
|
|
1368
|
+
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}).`
|
|
1369
|
+
});
|
|
1370
|
+
imageConfig = geminiApiImageConfig;
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1321
1373
|
const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
|
|
1322
1374
|
const isGemini3Model = /^gemini-3[.-]/.test(this.modelId);
|
|
1323
1375
|
const supportsFunctionResponseParts = isGemini3Model;
|
|
@@ -1386,9 +1438,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1386
1438
|
...(googleOptions == null ? void 0 : googleOptions.mediaResolution) && {
|
|
1387
1439
|
mediaResolution: googleOptions.mediaResolution
|
|
1388
1440
|
},
|
|
1389
|
-
...
|
|
1390
|
-
imageConfig: googleOptions.imageConfig
|
|
1391
|
-
}
|
|
1441
|
+
...imageConfig && { imageConfig }
|
|
1392
1442
|
},
|
|
1393
1443
|
contents,
|
|
1394
1444
|
systemInstruction: isGemmaModel ? void 0 : systemInstruction,
|