@ai-sdk/google 4.0.0-beta.8 → 4.0.0-beta.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 +608 -5
- package/README.md +6 -4
- package/dist/index.d.ts +297 -54
- package/dist/index.js +5409 -640
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +97 -26
- package/dist/internal/index.js +1653 -453
- package/dist/internal/index.js.map +1 -1
- package/docs/{15-google-generative-ai.mdx → 15-google.mdx} +784 -69
- package/package.json +16 -17
- package/src/{convert-google-generative-ai-usage.ts → convert-google-usage.ts} +13 -5
- package/src/convert-json-schema-to-openapi-schema.ts +1 -1
- package/src/convert-to-google-messages.ts +647 -0
- package/src/{google-generative-ai-embedding-options.ts → google-embedding-model-options.ts} +9 -2
- package/src/{google-generative-ai-embedding-model.ts → google-embedding-model.ts} +31 -18
- package/src/google-error.ts +1 -1
- package/src/google-files.ts +225 -0
- package/src/google-image-model-options.ts +35 -0
- package/src/{google-generative-ai-image-model.ts → google-image-model.ts} +116 -65
- package/src/{google-generative-ai-image-settings.ts → google-image-settings.ts} +2 -2
- package/src/google-json-accumulator.ts +371 -0
- package/src/{google-generative-ai-options.ts → google-language-model-options.ts} +50 -5
- package/src/{google-generative-ai-language-model.ts → google-language-model.ts} +691 -217
- package/src/google-prepare-tools.ts +72 -12
- package/src/google-prompt.ts +86 -0
- package/src/google-provider.ts +157 -53
- package/src/google-speech-api.ts +36 -0
- package/src/google-speech-model-options.ts +48 -0
- package/src/google-speech-model.ts +311 -0
- package/src/google-video-model-options.ts +43 -0
- package/src/{google-generative-ai-video-model.ts → google-video-model.ts} +25 -60
- package/src/{google-generative-ai-video-settings.ts → google-video-settings.ts} +2 -1
- package/src/index.ts +40 -9
- package/src/interactions/build-google-interactions-stream-transform.ts +818 -0
- package/src/interactions/cancel-google-interaction.ts +60 -0
- package/src/interactions/convert-google-interactions-usage.ts +47 -0
- package/src/interactions/convert-to-google-interactions-input.ts +557 -0
- package/src/interactions/extract-google-interactions-sources.ts +252 -0
- package/src/interactions/google-interactions-agent.ts +15 -0
- package/src/interactions/google-interactions-api.ts +530 -0
- package/src/interactions/google-interactions-language-model-options.ts +262 -0
- package/src/interactions/google-interactions-language-model.ts +776 -0
- package/src/interactions/google-interactions-prompt.ts +582 -0
- package/src/interactions/google-interactions-provider-metadata.ts +23 -0
- package/src/interactions/map-google-interactions-finish-reason.ts +31 -0
- package/src/interactions/parse-google-interactions-outputs.ts +252 -0
- package/src/interactions/poll-google-interactions.ts +129 -0
- package/src/interactions/prepare-google-interactions-tools.ts +245 -0
- package/src/interactions/stream-google-interactions.ts +242 -0
- package/src/interactions/synthesize-google-interactions-agent-stream.ts +185 -0
- package/src/internal/index.ts +3 -2
- package/src/{map-google-generative-ai-finish-reason.ts → map-google-finish-reason.ts} +3 -3
- package/src/realtime/google-realtime-event-mapper.ts +383 -0
- package/src/realtime/google-realtime-model-options.ts +3 -0
- package/src/realtime/google-realtime-model.ts +160 -0
- package/src/realtime/index.ts +2 -0
- package/src/tool/code-execution.ts +2 -2
- package/src/tool/enterprise-web-search.ts +9 -3
- package/src/tool/file-search.ts +5 -7
- package/src/tool/google-maps.ts +3 -2
- package/src/tool/google-search.ts +11 -12
- package/src/tool/url-context.ts +4 -2
- package/src/tool/vertex-rag-store.ts +9 -6
- package/dist/index.d.mts +0 -384
- package/dist/index.mjs +0 -2519
- package/dist/index.mjs.map +0 -1
- package/dist/internal/index.d.mts +0 -287
- package/dist/internal/index.mjs +0 -1708
- package/dist/internal/index.mjs.map +0 -1
- package/src/convert-to-google-generative-ai-messages.ts +0 -239
- package/src/google-generative-ai-prompt.ts +0 -47
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
2
2
|
import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import {
|
|
3
|
+
import { ProviderV4, LanguageModelV4, ImageModelV4, EmbeddingModelV4, Experimental_VideoModelV4, SpeechModelV4, FilesV4, Experimental_RealtimeFactoryV4, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4ClientSecretOptions, Experimental_RealtimeModelV4ClientSecretResult, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeModelV4SessionConfig } from '@ai-sdk/provider';
|
|
4
4
|
|
|
5
5
|
declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
6
6
|
error: {
|
|
@@ -11,7 +11,7 @@ declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
11
11
|
}>;
|
|
12
12
|
type GoogleErrorData = InferSchema<typeof googleErrorDataSchema>;
|
|
13
13
|
|
|
14
|
-
type
|
|
14
|
+
type GoogleModelId = '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-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'deep-research-max-preview-04-2026' | 'deep-research-preview-04-2026' | '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 & {});
|
|
15
15
|
declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
16
16
|
responseModalities?: ("TEXT" | "IMAGE")[] | undefined;
|
|
17
17
|
thinkingConfig?: {
|
|
@@ -39,6 +39,10 @@ declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
39
39
|
longitude: number;
|
|
40
40
|
} | undefined;
|
|
41
41
|
} | undefined;
|
|
42
|
+
streamFunctionCallArguments?: boolean | undefined;
|
|
43
|
+
serviceTier?: "standard" | "flex" | "priority" | undefined;
|
|
44
|
+
sharedRequestType?: "standard" | "flex" | "priority" | undefined;
|
|
45
|
+
requestType?: "shared" | undefined;
|
|
42
46
|
}>;
|
|
43
47
|
type GoogleLanguageModelOptions = InferSchema<typeof googleLanguageModelOptions>;
|
|
44
48
|
|
|
@@ -47,8 +51,18 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
47
51
|
content?: Record<string, never> | {
|
|
48
52
|
parts?: ({
|
|
49
53
|
functionCall: {
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
id?: string | null | undefined;
|
|
55
|
+
name?: string | null | undefined;
|
|
56
|
+
args?: unknown;
|
|
57
|
+
partialArgs?: {
|
|
58
|
+
jsonPath: string;
|
|
59
|
+
stringValue?: string | null | undefined;
|
|
60
|
+
numberValue?: number | null | undefined;
|
|
61
|
+
boolValue?: boolean | null | undefined;
|
|
62
|
+
nullValue?: unknown;
|
|
63
|
+
willContinue?: boolean | null | undefined;
|
|
64
|
+
}[] | null | undefined;
|
|
65
|
+
willContinue?: boolean | null | undefined;
|
|
52
66
|
};
|
|
53
67
|
thoughtSignature?: string | null | undefined;
|
|
54
68
|
} | {
|
|
@@ -58,6 +72,20 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
58
72
|
};
|
|
59
73
|
thought?: boolean | null | undefined;
|
|
60
74
|
thoughtSignature?: string | null | undefined;
|
|
75
|
+
} | {
|
|
76
|
+
toolCall: {
|
|
77
|
+
toolType: string;
|
|
78
|
+
id: string;
|
|
79
|
+
args?: unknown;
|
|
80
|
+
};
|
|
81
|
+
thoughtSignature?: string | null | undefined;
|
|
82
|
+
} | {
|
|
83
|
+
toolResponse: {
|
|
84
|
+
toolType: string;
|
|
85
|
+
id: string;
|
|
86
|
+
response?: unknown;
|
|
87
|
+
};
|
|
88
|
+
thoughtSignature?: string | null | undefined;
|
|
61
89
|
} | {
|
|
62
90
|
executableCode?: {
|
|
63
91
|
language: string;
|
|
@@ -143,6 +171,15 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
143
171
|
candidatesTokenCount?: number | null | undefined;
|
|
144
172
|
totalTokenCount?: number | null | undefined;
|
|
145
173
|
trafficType?: string | null | undefined;
|
|
174
|
+
serviceTier?: string | null | undefined;
|
|
175
|
+
promptTokensDetails?: {
|
|
176
|
+
modality: string;
|
|
177
|
+
tokenCount: number;
|
|
178
|
+
}[] | null | undefined;
|
|
179
|
+
candidatesTokensDetails?: {
|
|
180
|
+
modality: string;
|
|
181
|
+
tokenCount: number;
|
|
182
|
+
}[] | null | undefined;
|
|
146
183
|
} | null | undefined;
|
|
147
184
|
promptFeedback?: {
|
|
148
185
|
blockReason?: string | null | undefined;
|
|
@@ -162,35 +199,39 @@ type SafetyRatingSchema = NonNullable<InferSchema<typeof responseSchema>['candid
|
|
|
162
199
|
type PromptFeedbackSchema = NonNullable<InferSchema<typeof responseSchema>['promptFeedback']>;
|
|
163
200
|
type UsageMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['usageMetadata']>;
|
|
164
201
|
|
|
165
|
-
type
|
|
166
|
-
type
|
|
167
|
-
type
|
|
168
|
-
type
|
|
169
|
-
type
|
|
170
|
-
interface
|
|
171
|
-
promptFeedback:
|
|
172
|
-
groundingMetadata:
|
|
173
|
-
urlContextMetadata:
|
|
174
|
-
safetyRatings:
|
|
175
|
-
usageMetadata:
|
|
202
|
+
type GoogleGroundingMetadata = GroundingMetadataSchema;
|
|
203
|
+
type GoogleUrlContextMetadata = UrlContextMetadataSchema;
|
|
204
|
+
type GoogleSafetyRating = SafetyRatingSchema;
|
|
205
|
+
type GooglePromptFeedback = PromptFeedbackSchema;
|
|
206
|
+
type GoogleUsageMetadata = UsageMetadataSchema;
|
|
207
|
+
interface GoogleProviderMetadata {
|
|
208
|
+
promptFeedback: GooglePromptFeedback | null;
|
|
209
|
+
groundingMetadata: GoogleGroundingMetadata | null;
|
|
210
|
+
urlContextMetadata: GoogleUrlContextMetadata | null;
|
|
211
|
+
safetyRatings: GoogleSafetyRating[] | null;
|
|
212
|
+
usageMetadata: GoogleUsageMetadata | null;
|
|
176
213
|
finishMessage: string | null;
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | 'gemini-3.1-flash-image-preview' | (string & {});
|
|
180
|
-
interface GoogleGenerativeAIImageSettings {
|
|
181
|
-
/**
|
|
182
|
-
* Override the maximum number of images per call (default 4)
|
|
183
|
-
*/
|
|
184
|
-
maxImagesPerCall?: number;
|
|
214
|
+
serviceTier: string | null;
|
|
185
215
|
}
|
|
186
216
|
|
|
187
217
|
declare const googleImageModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
188
218
|
personGeneration?: "dont_allow" | "allow_adult" | "allow_all" | null | undefined;
|
|
189
219
|
aspectRatio?: "1:1" | "3:4" | "4:3" | "9:16" | "16:9" | null | undefined;
|
|
220
|
+
googleSearch?: {
|
|
221
|
+
[x: string]: unknown;
|
|
222
|
+
searchTypes?: {
|
|
223
|
+
webSearch?: Record<string, never> | undefined;
|
|
224
|
+
imageSearch?: Record<string, never> | undefined;
|
|
225
|
+
} | undefined;
|
|
226
|
+
timeRangeFilter?: {
|
|
227
|
+
startTime: string;
|
|
228
|
+
endTime: string;
|
|
229
|
+
} | undefined;
|
|
230
|
+
} | undefined;
|
|
190
231
|
}>;
|
|
191
232
|
type GoogleImageModelOptions = InferSchema<typeof googleImageModelOptionsSchema>;
|
|
192
233
|
|
|
193
|
-
type
|
|
234
|
+
type GoogleEmbeddingModelId = 'gemini-embedding-001' | 'gemini-embedding-2' | 'gemini-embedding-2-preview' | (string & {});
|
|
194
235
|
declare const googleEmbeddingModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
195
236
|
outputDimensionality?: number | undefined;
|
|
196
237
|
taskType?: "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "CLUSTERING" | "RETRIEVAL_DOCUMENT" | "RETRIEVAL_QUERY" | "QUESTION_ANSWERING" | "FACT_VERIFICATION" | "CODE_RETRIEVAL_QUERY" | undefined;
|
|
@@ -201,12 +242,15 @@ declare const googleEmbeddingModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
201
242
|
mimeType: string;
|
|
202
243
|
data: string;
|
|
203
244
|
};
|
|
245
|
+
} | {
|
|
246
|
+
fileData: {
|
|
247
|
+
fileUri: string;
|
|
248
|
+
mimeType: string;
|
|
249
|
+
};
|
|
204
250
|
})[] | null)[] | undefined;
|
|
205
251
|
}>;
|
|
206
252
|
type GoogleEmbeddingModelOptions = InferSchema<typeof googleEmbeddingModelOptions>;
|
|
207
253
|
|
|
208
|
-
type GoogleGenerativeAIVideoModelId = 'veo-3.1-fast-generate-preview' | 'veo-3.1-generate-preview' | 'veo-3.1-generate' | 'veo-3.0-generate-001' | 'veo-3.0-fast-generate-001' | 'veo-2.0-generate-001' | (string & {});
|
|
209
|
-
|
|
210
254
|
type GoogleVideoModelOptions = {
|
|
211
255
|
pollIntervalMs?: number | null;
|
|
212
256
|
pollTimeoutMs?: number | null;
|
|
@@ -219,12 +263,154 @@ type GoogleVideoModelOptions = {
|
|
|
219
263
|
[key: string]: unknown;
|
|
220
264
|
};
|
|
221
265
|
|
|
266
|
+
type GoogleVideoModelId = 'veo-3.1-fast-generate-preview' | 'veo-3.1-generate-preview' | 'veo-3.1-generate' | 'veo-3.1-lite-generate-preview' | 'veo-3.0-generate-001' | 'veo-3.0-fast-generate-001' | 'veo-2.0-generate-001' | (string & {});
|
|
267
|
+
|
|
268
|
+
type GoogleSpeechModelId = 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-3.1-flash-tts-preview' | (string & {});
|
|
269
|
+
declare const googleSpeechProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
270
|
+
multiSpeakerVoiceConfig?: {
|
|
271
|
+
speakerVoiceConfigs: {
|
|
272
|
+
speaker: string;
|
|
273
|
+
voiceConfig: {
|
|
274
|
+
prebuiltVoiceConfig: {
|
|
275
|
+
voiceName: string;
|
|
276
|
+
};
|
|
277
|
+
};
|
|
278
|
+
}[];
|
|
279
|
+
} | undefined;
|
|
280
|
+
}>;
|
|
281
|
+
type GoogleSpeechModelOptions = InferSchema<typeof googleSpeechProviderOptionsSchema>;
|
|
282
|
+
|
|
283
|
+
type GoogleFilesUploadOptions = {
|
|
284
|
+
displayName?: string | null;
|
|
285
|
+
pollIntervalMs?: number | null;
|
|
286
|
+
pollTimeoutMs?: number | null;
|
|
287
|
+
[key: string]: unknown;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Type-only union of Gemini model IDs that the Interactions API accepts via
|
|
292
|
+
* `model:`. Mirrors `Model` from `googleapis/js-genai`
|
|
293
|
+
* `src/interactions/resources/interactions.ts`.
|
|
294
|
+
*
|
|
295
|
+
* Kept as a separate type from `GoogleModelId` even though most IDs overlap;
|
|
296
|
+
* the two surfaces (`:generateContent` vs `/interactions`) are independent and
|
|
297
|
+
* may diverge over time.
|
|
298
|
+
*/
|
|
299
|
+
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' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {});
|
|
300
|
+
/**
|
|
301
|
+
* Provider-options schema for `google.interactions(...)` calls. Read from the
|
|
302
|
+
* shared `providerOptions.google.*` namespace (per PRD); per-call options that
|
|
303
|
+
* the AI SDK doesn't natively expose live here.
|
|
304
|
+
*
|
|
305
|
+
* All fields are `.nullish()` per the existing google provider convention.
|
|
306
|
+
*/
|
|
307
|
+
declare const googleInteractionsLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
308
|
+
previousInteractionId?: string | null | undefined;
|
|
309
|
+
store?: boolean | null | undefined;
|
|
310
|
+
agent?: string | null | undefined;
|
|
311
|
+
agentConfig?: {
|
|
312
|
+
[x: string]: unknown;
|
|
313
|
+
type: "dynamic";
|
|
314
|
+
} | {
|
|
315
|
+
type: "deep-research";
|
|
316
|
+
thinkingSummaries?: "auto" | "none" | null | undefined;
|
|
317
|
+
visualization?: "auto" | "off" | null | undefined;
|
|
318
|
+
collaborativePlanning?: boolean | null | undefined;
|
|
319
|
+
} | null | undefined;
|
|
320
|
+
thinkingLevel?: "minimal" | "low" | "medium" | "high" | null | undefined;
|
|
321
|
+
thinkingSummaries?: "auto" | "none" | null | undefined;
|
|
322
|
+
responseFormat?: ({
|
|
323
|
+
[x: string]: unknown;
|
|
324
|
+
type: "text";
|
|
325
|
+
mimeType?: string | null | undefined;
|
|
326
|
+
schema?: unknown;
|
|
327
|
+
} | {
|
|
328
|
+
[x: string]: unknown;
|
|
329
|
+
type: "image";
|
|
330
|
+
mimeType?: string | null | undefined;
|
|
331
|
+
aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "1:8" | "8:1" | "1:4" | "4:1" | null | undefined;
|
|
332
|
+
imageSize?: "1K" | "2K" | "4K" | "512" | null | undefined;
|
|
333
|
+
} | {
|
|
334
|
+
[x: string]: unknown;
|
|
335
|
+
type: "audio";
|
|
336
|
+
mimeType?: string | null | undefined;
|
|
337
|
+
})[] | null | undefined;
|
|
338
|
+
imageConfig?: {
|
|
339
|
+
aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "1:8" | "8:1" | "1:4" | "4:1" | null | undefined;
|
|
340
|
+
imageSize?: "1K" | "2K" | "4K" | "512" | null | undefined;
|
|
341
|
+
} | null | undefined;
|
|
342
|
+
mediaResolution?: "low" | "medium" | "high" | "ultra_high" | null | undefined;
|
|
343
|
+
responseModalities?: ("text" | "image" | "document" | "audio" | "video")[] | null | undefined;
|
|
344
|
+
serviceTier?: "standard" | "flex" | "priority" | null | undefined;
|
|
345
|
+
systemInstruction?: string | null | undefined;
|
|
346
|
+
signature?: string | null | undefined;
|
|
347
|
+
interactionId?: string | null | undefined;
|
|
348
|
+
pollingTimeoutMs?: number | null | undefined;
|
|
349
|
+
background?: boolean | null | undefined;
|
|
350
|
+
environment?: string | {
|
|
351
|
+
type: "remote";
|
|
352
|
+
sources?: ({
|
|
353
|
+
type: "gcs";
|
|
354
|
+
source: string;
|
|
355
|
+
target?: string | null | undefined;
|
|
356
|
+
} | {
|
|
357
|
+
type: "repository";
|
|
358
|
+
source: string;
|
|
359
|
+
target?: string | null | undefined;
|
|
360
|
+
} | {
|
|
361
|
+
type: "inline";
|
|
362
|
+
content: string;
|
|
363
|
+
target: string;
|
|
364
|
+
})[] | null | undefined;
|
|
365
|
+
network?: "disabled" | {
|
|
366
|
+
allowlist: {
|
|
367
|
+
domain: string;
|
|
368
|
+
transform?: Record<string, string>[] | null | undefined;
|
|
369
|
+
}[];
|
|
370
|
+
} | null | undefined;
|
|
371
|
+
} | null | undefined;
|
|
372
|
+
}>;
|
|
373
|
+
type GoogleLanguageModelInteractionsOptions = InferSchema<typeof googleInteractionsLanguageModelOptions>;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Provider-metadata shape that the Gemini Interactions language model writes
|
|
377
|
+
* onto `result.providerMetadata.google` (and reads back from input messages on
|
|
378
|
+
* the next turn for stateful chaining and signature round-trip).
|
|
379
|
+
*/
|
|
380
|
+
type GoogleInteractionsProviderMetadata = {
|
|
381
|
+
/**
|
|
382
|
+
* Gemini-server-side interaction id (`Interaction.id`). Pass back in
|
|
383
|
+
* `providerOptions.google.previousInteractionId` to chain stateful turns.
|
|
384
|
+
*/
|
|
385
|
+
interactionId?: string;
|
|
386
|
+
/**
|
|
387
|
+
* Service tier used for this interaction (passthrough for observability).
|
|
388
|
+
*/
|
|
389
|
+
serviceTier?: string;
|
|
390
|
+
/**
|
|
391
|
+
* Per-block signature hash for backend validation. Set by the SDK on output
|
|
392
|
+
* reasoning / tool-call parts and round-tripped on input parts.
|
|
393
|
+
*/
|
|
394
|
+
signature?: string;
|
|
395
|
+
};
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Type-only module: declares the union of supported Gemini Interactions agent
|
|
399
|
+
* names. Used by the `google.interactions({ agent })` factory branch.
|
|
400
|
+
*
|
|
401
|
+
* Strict string-literal union: unknown agent names are a compile-time error.
|
|
402
|
+
* User-defined agents (created via the `/agents` endpoint) are addressed by
|
|
403
|
+
* a separate `{ managedAgent: string }` factory shape — see
|
|
404
|
+
* `GoogleInteractionsModelInput`.
|
|
405
|
+
*/
|
|
406
|
+
type GoogleInteractionsAgentName = 'deep-research-pro-preview-12-2025' | 'deep-research-preview-04-2026' | 'deep-research-max-preview-04-2026' | 'antigravity-preview-05-2026';
|
|
407
|
+
|
|
222
408
|
declare const googleTools: {
|
|
223
409
|
/**
|
|
224
410
|
* Creates a Google search tool that gives Google direct access to real-time web content.
|
|
225
411
|
* Must have name "google_search".
|
|
226
412
|
*/
|
|
227
|
-
googleSearch: _ai_sdk_provider_utils.
|
|
413
|
+
googleSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {
|
|
228
414
|
[x: string]: unknown;
|
|
229
415
|
searchTypes?: {
|
|
230
416
|
webSearch?: Record<string, never> | undefined;
|
|
@@ -234,7 +420,7 @@ declare const googleTools: {
|
|
|
234
420
|
startTime: string;
|
|
235
421
|
endTime: string;
|
|
236
422
|
} | undefined;
|
|
237
|
-
}>;
|
|
423
|
+
}, {}>;
|
|
238
424
|
/**
|
|
239
425
|
* Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
|
|
240
426
|
* Designed for highly-regulated industries (finance, healthcare, public sector).
|
|
@@ -245,7 +431,7 @@ declare const googleTools: {
|
|
|
245
431
|
*
|
|
246
432
|
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
|
|
247
433
|
*/
|
|
248
|
-
enterpriseWebSearch: _ai_sdk_provider_utils.
|
|
434
|
+
enterpriseWebSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
|
|
249
435
|
/**
|
|
250
436
|
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
|
|
251
437
|
* Must have name "google_maps".
|
|
@@ -253,12 +439,12 @@ declare const googleTools: {
|
|
|
253
439
|
* @see https://ai.google.dev/gemini-api/docs/maps-grounding
|
|
254
440
|
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
255
441
|
*/
|
|
256
|
-
googleMaps: _ai_sdk_provider_utils.
|
|
442
|
+
googleMaps: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
|
|
257
443
|
/**
|
|
258
444
|
* Creates a URL context tool that gives Google direct access to real-time web content.
|
|
259
445
|
* Must have name "url_context".
|
|
260
446
|
*/
|
|
261
|
-
urlContext: _ai_sdk_provider_utils.
|
|
447
|
+
urlContext: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
|
|
262
448
|
/**
|
|
263
449
|
* Enables Retrieval Augmented Generation (RAG) via the Gemini File Search tool.
|
|
264
450
|
* Must have name "file_search".
|
|
@@ -269,12 +455,12 @@ declare const googleTools: {
|
|
|
269
455
|
*
|
|
270
456
|
* @see https://ai.google.dev/gemini-api/docs/file-search
|
|
271
457
|
*/
|
|
272
|
-
fileSearch: _ai_sdk_provider_utils.
|
|
458
|
+
fileSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {
|
|
273
459
|
[x: string]: unknown;
|
|
274
460
|
fileSearchStoreNames: string[];
|
|
275
461
|
topK?: number | undefined;
|
|
276
462
|
metadataFilter?: string | undefined;
|
|
277
|
-
}>;
|
|
463
|
+
}, {}>;
|
|
278
464
|
/**
|
|
279
465
|
* A tool that enables the model to generate and run Python code.
|
|
280
466
|
* Must have name "code_execution".
|
|
@@ -285,62 +471,93 @@ declare const googleTools: {
|
|
|
285
471
|
* @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)
|
|
286
472
|
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)
|
|
287
473
|
*/
|
|
288
|
-
codeExecution: _ai_sdk_provider_utils.
|
|
474
|
+
codeExecution: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
289
475
|
language: string;
|
|
290
476
|
code: string;
|
|
291
477
|
}, {
|
|
292
478
|
outcome: string;
|
|
293
479
|
output: string;
|
|
294
|
-
}, {}>;
|
|
480
|
+
}, {}, {}>;
|
|
295
481
|
/**
|
|
296
482
|
* Creates a Vertex RAG Store tool that enables the model to perform RAG searches against a Vertex RAG Store.
|
|
297
483
|
* Must have name "vertex_rag_store".
|
|
298
484
|
*/
|
|
299
|
-
vertexRagStore: _ai_sdk_provider_utils.
|
|
485
|
+
vertexRagStore: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {
|
|
300
486
|
ragCorpus: string;
|
|
301
487
|
topK?: number;
|
|
302
|
-
}>;
|
|
488
|
+
}, {}>;
|
|
303
489
|
};
|
|
304
490
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
491
|
+
type GoogleImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | 'gemini-3.1-flash-image-preview' | (string & {});
|
|
492
|
+
interface GoogleImageSettings {
|
|
493
|
+
/**
|
|
494
|
+
* Override the maximum number of images per call (default 4)
|
|
495
|
+
*/
|
|
496
|
+
maxImagesPerCall?: number;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
interface GoogleProvider extends ProviderV4 {
|
|
500
|
+
(modelId: GoogleModelId): LanguageModelV4;
|
|
501
|
+
languageModel(modelId: GoogleModelId): LanguageModelV4;
|
|
502
|
+
chat(modelId: GoogleModelId): LanguageModelV4;
|
|
309
503
|
/**
|
|
310
504
|
* Creates a model for image generation.
|
|
311
505
|
*/
|
|
312
|
-
image(modelId:
|
|
506
|
+
image(modelId: GoogleImageModelId, settings?: GoogleImageSettings): ImageModelV4;
|
|
313
507
|
/**
|
|
314
508
|
* @deprecated Use `chat()` instead.
|
|
315
509
|
*/
|
|
316
|
-
generativeAI(modelId:
|
|
510
|
+
generativeAI(modelId: GoogleModelId): LanguageModelV4;
|
|
317
511
|
/**
|
|
318
512
|
* Creates a model for text embeddings.
|
|
319
513
|
*/
|
|
320
|
-
embedding(modelId:
|
|
514
|
+
embedding(modelId: GoogleEmbeddingModelId): EmbeddingModelV4;
|
|
321
515
|
/**
|
|
322
516
|
* Creates a model for text embeddings.
|
|
323
517
|
*/
|
|
324
|
-
embeddingModel(modelId:
|
|
518
|
+
embeddingModel(modelId: GoogleEmbeddingModelId): EmbeddingModelV4;
|
|
325
519
|
/**
|
|
326
520
|
* @deprecated Use `embedding` instead.
|
|
327
521
|
*/
|
|
328
|
-
textEmbedding(modelId:
|
|
522
|
+
textEmbedding(modelId: GoogleEmbeddingModelId): EmbeddingModelV4;
|
|
329
523
|
/**
|
|
330
524
|
* @deprecated Use `embeddingModel` instead.
|
|
331
525
|
*/
|
|
332
|
-
textEmbeddingModel(modelId:
|
|
526
|
+
textEmbeddingModel(modelId: GoogleEmbeddingModelId): EmbeddingModelV4;
|
|
333
527
|
/**
|
|
334
528
|
* Creates a model for video generation.
|
|
335
529
|
*/
|
|
336
|
-
video(modelId:
|
|
530
|
+
video(modelId: GoogleVideoModelId): Experimental_VideoModelV4;
|
|
337
531
|
/**
|
|
338
532
|
* Creates a model for video generation.
|
|
339
533
|
*/
|
|
340
|
-
videoModel(modelId:
|
|
534
|
+
videoModel(modelId: GoogleVideoModelId): Experimental_VideoModelV4;
|
|
535
|
+
/**
|
|
536
|
+
* Creates a model for speech generation (text-to-speech).
|
|
537
|
+
*/
|
|
538
|
+
speech(modelId: GoogleSpeechModelId): SpeechModelV4;
|
|
539
|
+
/**
|
|
540
|
+
* Creates a model for speech generation (text-to-speech).
|
|
541
|
+
*/
|
|
542
|
+
speechModel(modelId: GoogleSpeechModelId): SpeechModelV4;
|
|
543
|
+
files(): FilesV4;
|
|
544
|
+
/**
|
|
545
|
+
* Creates a language model targeting the Gemini Interactions API
|
|
546
|
+
* (`POST /v1beta/interactions`). Pass:
|
|
547
|
+
* - a model ID (string),
|
|
548
|
+
* - `{ agent: <name> }` to use a known Gemini agent preset, or
|
|
549
|
+
* - `{ managedAgent: <name> }` to use a user-defined agent created via
|
|
550
|
+
* the `/v1beta/agents` endpoint.
|
|
551
|
+
*/
|
|
552
|
+
interactions(modelIdOrAgent: GoogleInteractionsModelId | {
|
|
553
|
+
agent: GoogleInteractionsAgentName;
|
|
554
|
+
} | {
|
|
555
|
+
managedAgent: string;
|
|
556
|
+
}): LanguageModelV4;
|
|
557
|
+
experimental_realtime: Experimental_RealtimeFactoryV4;
|
|
341
558
|
tools: typeof googleTools;
|
|
342
559
|
}
|
|
343
|
-
interface
|
|
560
|
+
interface GoogleProviderSettings {
|
|
344
561
|
/**
|
|
345
562
|
* Use a different URL prefix for API calls, e.g. to use proxy servers.
|
|
346
563
|
* The default prefix is `https://generativelanguage.googleapis.com/v1beta`.
|
|
@@ -371,14 +588,40 @@ interface GoogleGenerativeAIProviderSettings {
|
|
|
371
588
|
name?: string;
|
|
372
589
|
}
|
|
373
590
|
/**
|
|
374
|
-
* Create a Google
|
|
591
|
+
* Create a Google provider instance.
|
|
375
592
|
*/
|
|
376
|
-
declare function
|
|
593
|
+
declare function createGoogle(options?: GoogleProviderSettings): GoogleProvider;
|
|
377
594
|
/**
|
|
378
595
|
* Default Google Generative AI provider instance.
|
|
379
596
|
*/
|
|
380
|
-
declare const google:
|
|
597
|
+
declare const google: GoogleProvider;
|
|
598
|
+
|
|
599
|
+
type GoogleRealtimeModelConfig = {
|
|
600
|
+
provider: string;
|
|
601
|
+
baseURL: string;
|
|
602
|
+
headers: () => Record<string, string | undefined>;
|
|
603
|
+
fetch?: FetchFunction;
|
|
604
|
+
};
|
|
605
|
+
declare class GoogleRealtimeModel implements Experimental_RealtimeModelV4 {
|
|
606
|
+
readonly specificationVersion: "v4";
|
|
607
|
+
readonly provider: string;
|
|
608
|
+
readonly modelId: string;
|
|
609
|
+
private readonly config;
|
|
610
|
+
private readonly mapper;
|
|
611
|
+
constructor(modelId: string, config: GoogleRealtimeModelConfig);
|
|
612
|
+
doCreateClientSecret(options: Experimental_RealtimeModelV4ClientSecretOptions): Promise<Experimental_RealtimeModelV4ClientSecretResult>;
|
|
613
|
+
getWebSocketConfig(options: {
|
|
614
|
+
token: string;
|
|
615
|
+
url: string;
|
|
616
|
+
}): {
|
|
617
|
+
url: string;
|
|
618
|
+
protocols?: string[];
|
|
619
|
+
};
|
|
620
|
+
parseServerEvent(raw: unknown): Experimental_RealtimeModelV4ServerEvent | Experimental_RealtimeModelV4ServerEvent[];
|
|
621
|
+
serializeClientEvent(event: Experimental_RealtimeModelV4ClientEvent): ReturnType<Experimental_RealtimeModelV4['serializeClientEvent']>;
|
|
622
|
+
buildSessionConfig(config: Experimental_RealtimeModelV4SessionConfig): Record<string, unknown>;
|
|
623
|
+
}
|
|
381
624
|
|
|
382
625
|
declare const VERSION: string;
|
|
383
626
|
|
|
384
|
-
export { type GoogleEmbeddingModelOptions, type GoogleErrorData, type GoogleEmbeddingModelOptions as GoogleGenerativeAIEmbeddingProviderOptions, type GoogleImageModelOptions as GoogleGenerativeAIImageProviderOptions, type GoogleGenerativeAIProvider, type GoogleGenerativeAIProviderMetadata, type GoogleLanguageModelOptions as GoogleGenerativeAIProviderOptions, type GoogleGenerativeAIProviderSettings, type GoogleGenerativeAIVideoModelId, type GoogleVideoModelOptions as GoogleGenerativeAIVideoProviderOptions, type GoogleImageModelOptions, type GoogleLanguageModelOptions, type GoogleVideoModelOptions, VERSION, createGoogleGenerativeAI, google };
|
|
627
|
+
export { GoogleRealtimeModel as Experimental_GoogleRealtimeModel, type GoogleRealtimeModelConfig as Experimental_GoogleRealtimeModelConfig, type GoogleEmbeddingModelOptions, type GoogleErrorData, type GoogleFilesUploadOptions, type GoogleEmbeddingModelOptions as GoogleGenerativeAIEmbeddingProviderOptions, type GoogleImageModelOptions as GoogleGenerativeAIImageProviderOptions, type GoogleProvider as GoogleGenerativeAIProvider, type GoogleProviderMetadata as GoogleGenerativeAIProviderMetadata, type GoogleLanguageModelOptions as GoogleGenerativeAIProviderOptions, type GoogleProviderSettings as GoogleGenerativeAIProviderSettings, type GoogleVideoModelId as GoogleGenerativeAIVideoModelId, type GoogleVideoModelOptions as GoogleGenerativeAIVideoProviderOptions, type GoogleImageModelOptions, type GoogleInteractionsAgentName, type GoogleInteractionsModelId, type GoogleInteractionsProviderMetadata, type GoogleLanguageModelInteractionsOptions, type GoogleLanguageModelOptions, type GoogleProvider, type GoogleProviderMetadata, type GoogleProviderSettings, type GoogleSpeechModelId, type GoogleSpeechModelOptions, type GoogleVideoModelId, type GoogleVideoModelOptions, VERSION, createGoogle, createGoogle as createGoogleGenerativeAI, google };
|