@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
|
@@ -346,7 +346,7 @@ declare class GoogleInteractionsLanguageModel implements LanguageModelV3 {
|
|
|
346
346
|
readonly modelId: string;
|
|
347
347
|
/**
|
|
348
348
|
* Optional agent name. When provided, the request body sends `agent:` instead
|
|
349
|
-
* of `model:` and rejects `
|
|
349
|
+
* of `model:` and rejects `generation_config` (warned, not thrown).
|
|
350
350
|
*/
|
|
351
351
|
readonly agent: string | undefined;
|
|
352
352
|
private readonly config;
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -346,7 +346,7 @@ declare class GoogleInteractionsLanguageModel implements LanguageModelV3 {
|
|
|
346
346
|
readonly modelId: string;
|
|
347
347
|
/**
|
|
348
348
|
* Optional agent name. When provided, the request body sends `agent:` instead
|
|
349
|
-
* of `model:` and rejects `
|
|
349
|
+
* of `model:` and rejects `generation_config` (warned, not thrown).
|
|
350
350
|
*/
|
|
351
351
|
readonly agent: string | undefined;
|
|
352
352
|
private readonly config;
|
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,
|
|
@@ -4918,12 +4968,7 @@ var GoogleInteractionsLanguageModel = class {
|
|
|
4918
4968
|
const hasTools = options.tools != null && options.tools.length > 0;
|
|
4919
4969
|
let toolsForBody;
|
|
4920
4970
|
let toolChoiceForBody;
|
|
4921
|
-
if (hasTools
|
|
4922
|
-
warnings.push({
|
|
4923
|
-
type: "other",
|
|
4924
|
-
message: "google.interactions: tools are not supported when an agent is set; tools will be omitted from the request body."
|
|
4925
|
-
});
|
|
4926
|
-
} else if (hasTools) {
|
|
4971
|
+
if (hasTools) {
|
|
4927
4972
|
const prepared = prepareGoogleInteractionsTools({
|
|
4928
4973
|
tools: options.tools,
|
|
4929
4974
|
toolChoice: options.toolChoice
|