@ai-sdk/google 3.0.93 → 3.0.95
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 +2 -2
- package/src/google-generative-ai-language-model.ts +30 -3
- package/src/google-generative-ai-options.ts +40 -0
package/dist/internal/index.js
CHANGED
|
@@ -670,7 +670,38 @@ var googleLanguageModelOptions = (0, import_provider_utils3.lazySchema)(
|
|
|
670
670
|
"1:4",
|
|
671
671
|
"4:1"
|
|
672
672
|
]).optional(),
|
|
673
|
-
imageSize: import_v42.z.enum(["1K", "2K", "4K", "512"]).optional()
|
|
673
|
+
imageSize: import_v42.z.enum(["1K", "2K", "4K", "512"]).optional(),
|
|
674
|
+
/**
|
|
675
|
+
* Optional. Controls the generation of people in images.
|
|
676
|
+
* Vertex AI only.
|
|
677
|
+
*/
|
|
678
|
+
personGeneration: import_v42.z.enum([
|
|
679
|
+
"PERSON_GENERATION_UNSPECIFIED",
|
|
680
|
+
"ALLOW_ALL",
|
|
681
|
+
"ALLOW_ADULT",
|
|
682
|
+
"ALLOW_NONE"
|
|
683
|
+
]).optional(),
|
|
684
|
+
/**
|
|
685
|
+
* Optional. Controls whether generation of prominent people
|
|
686
|
+
* (celebrities) is allowed. When set together with
|
|
687
|
+
* `personGeneration`, `personGeneration` takes precedence.
|
|
688
|
+
* Vertex AI only.
|
|
689
|
+
*
|
|
690
|
+
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
|
|
691
|
+
*/
|
|
692
|
+
prominentPeople: import_v42.z.enum([
|
|
693
|
+
"PROMINENT_PEOPLE_UNSPECIFIED",
|
|
694
|
+
"ALLOW_PROMINENT_PEOPLE",
|
|
695
|
+
"BLOCK_PROMINENT_PEOPLE"
|
|
696
|
+
]).optional(),
|
|
697
|
+
/**
|
|
698
|
+
* Optional. The image output format for generated images.
|
|
699
|
+
* Vertex AI only.
|
|
700
|
+
*/
|
|
701
|
+
imageOutputOptions: import_v42.z.object({
|
|
702
|
+
mimeType: import_v42.z.enum(["image/jpeg", "image/png"]).optional(),
|
|
703
|
+
compressionQuality: import_v42.z.number().optional()
|
|
704
|
+
}).optional()
|
|
674
705
|
}).optional(),
|
|
675
706
|
/**
|
|
676
707
|
* Optional. Configuration for grounding retrieval.
|
|
@@ -1327,6 +1358,27 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1327
1358
|
}
|
|
1328
1359
|
} : void 0;
|
|
1329
1360
|
const bodyServiceTier = isVertexProvider ? void 0 : googleOptions == null ? void 0 : googleOptions.serviceTier;
|
|
1361
|
+
let imageConfig = googleOptions == null ? void 0 : googleOptions.imageConfig;
|
|
1362
|
+
if (imageConfig != null && !isVertexProvider) {
|
|
1363
|
+
const {
|
|
1364
|
+
personGeneration,
|
|
1365
|
+
prominentPeople,
|
|
1366
|
+
imageOutputOptions,
|
|
1367
|
+
...geminiApiImageConfig
|
|
1368
|
+
} = imageConfig;
|
|
1369
|
+
const droppedImageConfigFields = Object.entries({
|
|
1370
|
+
personGeneration,
|
|
1371
|
+
prominentPeople,
|
|
1372
|
+
imageOutputOptions
|
|
1373
|
+
}).filter(([, value]) => value != null).map(([key]) => `'imageConfig.${key}'`);
|
|
1374
|
+
if (droppedImageConfigFields.length > 0) {
|
|
1375
|
+
warnings.push({
|
|
1376
|
+
type: "other",
|
|
1377
|
+
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}).`
|
|
1378
|
+
});
|
|
1379
|
+
imageConfig = geminiApiImageConfig;
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1330
1382
|
const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
|
|
1331
1383
|
const isGemini3Model = /^gemini-3[.-]/.test(this.modelId);
|
|
1332
1384
|
const supportsFunctionResponseParts = isGemini3Model;
|
|
@@ -1395,9 +1447,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1395
1447
|
...(googleOptions == null ? void 0 : googleOptions.mediaResolution) && {
|
|
1396
1448
|
mediaResolution: googleOptions.mediaResolution
|
|
1397
1449
|
},
|
|
1398
|
-
...
|
|
1399
|
-
imageConfig: googleOptions.imageConfig
|
|
1400
|
-
}
|
|
1450
|
+
...imageConfig && { imageConfig }
|
|
1401
1451
|
},
|
|
1402
1452
|
contents,
|
|
1403
1453
|
systemInstruction: isGemmaModel ? void 0 : systemInstruction,
|