@ai-sdk/google 3.0.119 → 3.0.121
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 +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +43 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -24
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +2 -2
- package/dist/internal/index.d.ts +2 -2
- package/dist/internal/index.js +42 -23
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +42 -23
- package/dist/internal/index.mjs.map +1 -1
- package/docs/15-google-generative-ai.mdx +33 -6
- package/package.json +1 -1
- package/src/google-generative-ai-options.ts +1 -0
- package/src/interactions/google-interactions-language-model-options.ts +13 -2
- package/src/interactions/google-interactions-language-model.ts +11 -0
- package/src/interactions/google-interactions-prompt.ts +15 -1
|
@@ -3,7 +3,7 @@ import { Resolvable, FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
|
|
|
3
3
|
import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult } from '@ai-sdk/provider';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
|
|
6
|
-
type GoogleGenerativeAIModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
|
6
|
+
type GoogleGenerativeAIModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-3.8-flash' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
|
7
7
|
|
|
8
8
|
type GoogleGenerativeAIConfig = {
|
|
9
9
|
provider: string;
|
|
@@ -342,7 +342,7 @@ declare const googleTools: {
|
|
|
342
342
|
* the two surfaces (`:generateContent` vs `/interactions`) are independent and
|
|
343
343
|
* may diverge over time.
|
|
344
344
|
*/
|
|
345
|
-
type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
|
|
345
|
+
type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-3.8-flash' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
|
|
346
346
|
|
|
347
347
|
type GoogleInteractionsConfig = {
|
|
348
348
|
provider: string;
|
package/dist/internal/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Resolvable, FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
|
|
|
3
3
|
import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult } from '@ai-sdk/provider';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
|
|
6
|
-
type GoogleGenerativeAIModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
|
6
|
+
type GoogleGenerativeAIModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-3.8-flash' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
|
|
7
7
|
|
|
8
8
|
type GoogleGenerativeAIConfig = {
|
|
9
9
|
provider: string;
|
|
@@ -342,7 +342,7 @@ declare const googleTools: {
|
|
|
342
342
|
* the two surfaces (`:generateContent` vs `/interactions`) are independent and
|
|
343
343
|
* may diverge over time.
|
|
344
344
|
*/
|
|
345
|
-
type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
|
|
345
|
+
type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-3.8-flash' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
|
|
346
346
|
|
|
347
347
|
type GoogleInteractionsConfig = {
|
|
348
348
|
provider: string;
|
package/dist/internal/index.js
CHANGED
|
@@ -4279,8 +4279,8 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils14.lazySch
|
|
|
4279
4279
|
thinkingSummaries: import_v412.z.enum(["auto", "none"]).nullish(),
|
|
4280
4280
|
/**
|
|
4281
4281
|
* Output-format entries that map directly to the API's `response_format`
|
|
4282
|
-
* array. Use this to request image, audio, or non-JSON text
|
|
4283
|
-
* with
|
|
4282
|
+
* array. Use this to request image, audio, video, or non-JSON text
|
|
4283
|
+
* outputs with modality-specific controls.
|
|
4284
4284
|
*
|
|
4285
4285
|
* Entries are sent in order. The AI SDK call-level `responseFormat: {
|
|
4286
4286
|
* type: 'json', schema }` still drives JSON-mode and adds a matching
|
|
@@ -4317,6 +4317,14 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils14.lazySch
|
|
|
4317
4317
|
import_v412.z.object({
|
|
4318
4318
|
type: import_v412.z.literal("audio"),
|
|
4319
4319
|
mimeType: import_v412.z.string().nullish()
|
|
4320
|
+
}).loose(),
|
|
4321
|
+
import_v412.z.object({
|
|
4322
|
+
type: import_v412.z.literal("video"),
|
|
4323
|
+
aspectRatio: import_v412.z.enum(["16:9", "9:16"]).nullish(),
|
|
4324
|
+
resolution: import_v412.z.enum(["360p", "720p", "1080p", "4k"]).nullish(),
|
|
4325
|
+
duration: import_v412.z.string().nullish(),
|
|
4326
|
+
delivery: import_v412.z.enum(["inline", "uri"]).nullish(),
|
|
4327
|
+
gcsUri: import_v412.z.string().nullish()
|
|
4320
4328
|
}).loose()
|
|
4321
4329
|
])
|
|
4322
4330
|
).nullish(),
|
|
@@ -5203,7 +5211,7 @@ var GoogleInteractionsLanguageModel = class {
|
|
|
5203
5211
|
};
|
|
5204
5212
|
}
|
|
5205
5213
|
async getArgs(options) {
|
|
5206
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
|
|
5214
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
5207
5215
|
const warnings = [];
|
|
5208
5216
|
const opts = await (0, import_provider_utils18.parseProviderOptions)({
|
|
5209
5217
|
provider: "google",
|
|
@@ -5279,6 +5287,17 @@ var GoogleInteractionsLanguageModel = class {
|
|
|
5279
5287
|
mime_type: (_g = entry.mimeType) != null ? _g : void 0
|
|
5280
5288
|
})
|
|
5281
5289
|
);
|
|
5290
|
+
} else if (entry.type === "video") {
|
|
5291
|
+
responseFormatEntries.push(
|
|
5292
|
+
pruneUndefined({
|
|
5293
|
+
type: "video",
|
|
5294
|
+
aspect_ratio: (_h = entry.aspectRatio) != null ? _h : void 0,
|
|
5295
|
+
resolution: (_i = entry.resolution) != null ? _i : void 0,
|
|
5296
|
+
duration: (_j = entry.duration) != null ? _j : void 0,
|
|
5297
|
+
delivery: (_k = entry.delivery) != null ? _k : void 0,
|
|
5298
|
+
gcs_uri: (_l = entry.gcsUri) != null ? _l : void 0
|
|
5299
|
+
})
|
|
5300
|
+
);
|
|
5282
5301
|
}
|
|
5283
5302
|
}
|
|
5284
5303
|
}
|
|
@@ -5288,13 +5307,13 @@ var GoogleInteractionsLanguageModel = class {
|
|
|
5288
5307
|
warnings: convWarnings
|
|
5289
5308
|
} = convertToGoogleInteractionsInput({
|
|
5290
5309
|
prompt: options.prompt,
|
|
5291
|
-
previousInteractionId: (
|
|
5292
|
-
store: (
|
|
5293
|
-
mediaResolution: (
|
|
5310
|
+
previousInteractionId: (_m = opts == null ? void 0 : opts.previousInteractionId) != null ? _m : void 0,
|
|
5311
|
+
store: (_n = opts == null ? void 0 : opts.store) != null ? _n : void 0,
|
|
5312
|
+
mediaResolution: (_o = opts == null ? void 0 : opts.mediaResolution) != null ? _o : void 0
|
|
5294
5313
|
});
|
|
5295
5314
|
warnings.push(...convWarnings);
|
|
5296
5315
|
let systemInstruction = convertedSystemInstruction;
|
|
5297
|
-
const optionSystemInstruction = (
|
|
5316
|
+
const optionSystemInstruction = (_p = opts == null ? void 0 : opts.systemInstruction) != null ? _p : void 0;
|
|
5298
5317
|
if (systemInstruction != null && optionSystemInstruction != null) {
|
|
5299
5318
|
warnings.push({
|
|
5300
5319
|
type: "other",
|
|
@@ -5333,14 +5352,14 @@ var GoogleInteractionsLanguageModel = class {
|
|
|
5333
5352
|
generationConfig = void 0;
|
|
5334
5353
|
} else {
|
|
5335
5354
|
generationConfig = pruneUndefined({
|
|
5336
|
-
temperature: (
|
|
5337
|
-
top_p: (
|
|
5338
|
-
top_k: (
|
|
5339
|
-
seed: (
|
|
5355
|
+
temperature: (_q = options.temperature) != null ? _q : void 0,
|
|
5356
|
+
top_p: (_r = options.topP) != null ? _r : void 0,
|
|
5357
|
+
top_k: (_s = options.topK) != null ? _s : void 0,
|
|
5358
|
+
seed: (_t = options.seed) != null ? _t : void 0,
|
|
5340
5359
|
stop_sequences: options.stopSequences != null && options.stopSequences.length > 0 ? options.stopSequences : void 0,
|
|
5341
|
-
max_output_tokens: (
|
|
5342
|
-
thinking_level: (
|
|
5343
|
-
thinking_summaries: (
|
|
5360
|
+
max_output_tokens: (_u = options.maxOutputTokens) != null ? _u : void 0,
|
|
5361
|
+
thinking_level: (_v = opts == null ? void 0 : opts.thinkingLevel) != null ? _v : void 0,
|
|
5362
|
+
thinking_summaries: (_w = opts == null ? void 0 : opts.thinkingSummaries) != null ? _w : void 0,
|
|
5344
5363
|
tool_choice: toolChoiceForBody
|
|
5345
5364
|
});
|
|
5346
5365
|
if ((opts == null ? void 0 : opts.imageConfig) != null) {
|
|
@@ -5367,9 +5386,9 @@ var GoogleInteractionsLanguageModel = class {
|
|
|
5367
5386
|
if (ac.type === "deep-research") {
|
|
5368
5387
|
agentConfig = pruneUndefined({
|
|
5369
5388
|
type: "deep-research",
|
|
5370
|
-
thinking_summaries: (
|
|
5371
|
-
visualization: (
|
|
5372
|
-
collaborative_planning: (
|
|
5389
|
+
thinking_summaries: (_x = ac.thinkingSummaries) != null ? _x : void 0,
|
|
5390
|
+
visualization: (_y = ac.visualization) != null ? _y : void 0,
|
|
5391
|
+
collaborative_planning: (_z = ac.collaborativePlanning) != null ? _z : void 0
|
|
5373
5392
|
});
|
|
5374
5393
|
} else if (ac.type === "dynamic") {
|
|
5375
5394
|
agentConfig = { type: "dynamic" };
|
|
@@ -5386,7 +5405,7 @@ var GoogleInteractionsLanguageModel = class {
|
|
|
5386
5405
|
environment = opts.environment;
|
|
5387
5406
|
} else {
|
|
5388
5407
|
const env = opts.environment;
|
|
5389
|
-
const sources = (
|
|
5408
|
+
const sources = (_A = env.sources) == null ? void 0 : _A.map((s) => {
|
|
5390
5409
|
var _a2;
|
|
5391
5410
|
if (s.type === "inline") {
|
|
5392
5411
|
return {
|
|
@@ -5431,20 +5450,20 @@ var GoogleInteractionsLanguageModel = class {
|
|
|
5431
5450
|
tools: toolsForBody,
|
|
5432
5451
|
response_format: responseFormatEntries.length > 0 ? responseFormatEntries : void 0,
|
|
5433
5452
|
response_modalities: (opts == null ? void 0 : opts.responseModalities) != null ? opts.responseModalities : void 0,
|
|
5434
|
-
previous_interaction_id: (
|
|
5435
|
-
service_tier: (
|
|
5436
|
-
store: (
|
|
5453
|
+
previous_interaction_id: (_B = opts == null ? void 0 : opts.previousInteractionId) != null ? _B : void 0,
|
|
5454
|
+
service_tier: (_C = opts == null ? void 0 : opts.serviceTier) != null ? _C : void 0,
|
|
5455
|
+
store: (_D = opts == null ? void 0 : opts.store) != null ? _D : void 0,
|
|
5437
5456
|
generation_config: generationConfig != null && Object.keys(generationConfig).length > 0 ? generationConfig : void 0,
|
|
5438
5457
|
agent_config: agentConfig,
|
|
5439
5458
|
environment,
|
|
5440
|
-
background: (
|
|
5459
|
+
background: (_E = opts == null ? void 0 : opts.background) != null ? _E : void 0
|
|
5441
5460
|
});
|
|
5442
5461
|
return {
|
|
5443
5462
|
args,
|
|
5444
5463
|
warnings,
|
|
5445
5464
|
isAgent,
|
|
5446
5465
|
isBackground: (opts == null ? void 0 : opts.background) === true,
|
|
5447
|
-
pollingTimeoutMs: (
|
|
5466
|
+
pollingTimeoutMs: (_F = opts == null ? void 0 : opts.pollingTimeoutMs) != null ? _F : void 0
|
|
5448
5467
|
};
|
|
5449
5468
|
}
|
|
5450
5469
|
async doGenerate(options) {
|