@ai-sdk/google 4.0.0-beta.3 → 4.0.0-beta.30

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.
@@ -1,9 +1,9 @@
1
1
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
2
  import { Resolvable, FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
3
- import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult } from '@ai-sdk/provider';
3
+ import { LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult } 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-exp-image-generation' | '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-lite-preview-09-2025' | '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-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-lite-preview-09-2025' | '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-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;
@@ -14,10 +14,10 @@ type GoogleGenerativeAIConfig = {
14
14
  /**
15
15
  * The supported URLs for the model.
16
16
  */
17
- supportedUrls?: () => LanguageModelV3['supportedUrls'];
17
+ supportedUrls?: () => LanguageModelV4['supportedUrls'];
18
18
  };
19
- declare class GoogleGenerativeAILanguageModel implements LanguageModelV3 {
20
- readonly specificationVersion = "v3";
19
+ declare class GoogleGenerativeAILanguageModel implements LanguageModelV4 {
20
+ readonly specificationVersion = "v4";
21
21
  readonly modelId: GoogleGenerativeAIModelId;
22
22
  private readonly config;
23
23
  private readonly generateId;
@@ -25,8 +25,8 @@ declare class GoogleGenerativeAILanguageModel implements LanguageModelV3 {
25
25
  get provider(): string;
26
26
  get supportedUrls(): Record<string, RegExp[]> | PromiseLike<Record<string, RegExp[]>>;
27
27
  private getArgs;
28
- doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
29
- doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
28
+ doGenerate(options: LanguageModelV4CallOptions): Promise<LanguageModelV4GenerateResult>;
29
+ doStream(options: LanguageModelV4CallOptions): Promise<LanguageModelV4StreamResult>;
30
30
  }
31
31
  declare const getGroundingMetadataSchema: () => z.ZodObject<{
32
32
  webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
@@ -95,6 +95,21 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
95
95
  mimeType: string;
96
96
  data: string;
97
97
  };
98
+ thought?: boolean | null | undefined;
99
+ thoughtSignature?: string | null | undefined;
100
+ } | {
101
+ toolCall: {
102
+ toolType: string;
103
+ id: string;
104
+ args?: unknown;
105
+ };
106
+ thoughtSignature?: string | null | undefined;
107
+ } | {
108
+ toolResponse: {
109
+ toolType: string;
110
+ id: string;
111
+ response?: unknown;
112
+ };
98
113
  thoughtSignature?: string | null | undefined;
99
114
  } | {
100
115
  executableCode?: {
@@ -111,6 +126,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
111
126
  })[] | null | undefined;
112
127
  } | null | undefined;
113
128
  finishReason?: string | null | undefined;
129
+ finishMessage?: string | null | undefined;
114
130
  safetyRatings?: {
115
131
  category?: string | null | undefined;
116
132
  probability?: string | null | undefined;
@@ -180,6 +196,14 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
180
196
  candidatesTokenCount?: number | null | undefined;
181
197
  totalTokenCount?: number | null | undefined;
182
198
  trafficType?: string | null | undefined;
199
+ promptTokensDetails?: {
200
+ modality: string;
201
+ tokenCount: number;
202
+ }[] | null | undefined;
203
+ candidatesTokensDetails?: {
204
+ modality: string;
205
+ tokenCount: number;
206
+ }[] | null | undefined;
183
207
  } | null | undefined;
184
208
  promptFeedback?: {
185
209
  blockReason?: string | null | undefined;
@@ -192,10 +216,13 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
192
216
  blocked?: boolean | null | undefined;
193
217
  }[] | null | undefined;
194
218
  } | null | undefined;
219
+ serviceTier?: string | null | undefined;
195
220
  }>;
196
221
  type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
197
222
  type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
198
223
  type SafetyRatingSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['safetyRatings']>[number];
224
+ type PromptFeedbackSchema = NonNullable<InferSchema<typeof responseSchema>['promptFeedback']>;
225
+ type UsageMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['usageMetadata']>;
199
226
 
200
227
  declare const googleTools: {
201
228
  /**
@@ -212,7 +239,7 @@ declare const googleTools: {
212
239
  startTime: string;
213
240
  endTime: string;
214
241
  } | undefined;
215
- }>;
242
+ }, {}>;
216
243
  /**
217
244
  * Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
218
245
  * Designed for highly-regulated industries (finance, healthcare, public sector).
@@ -223,7 +250,7 @@ declare const googleTools: {
223
250
  *
224
251
  * @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
225
252
  */
226
- enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
253
+ enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
227
254
  /**
228
255
  * Creates a Google Maps grounding tool that gives the model access to Google Maps data.
229
256
  * Must have name "google_maps".
@@ -231,12 +258,12 @@ declare const googleTools: {
231
258
  * @see https://ai.google.dev/gemini-api/docs/maps-grounding
232
259
  * @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
233
260
  */
234
- googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
261
+ googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
235
262
  /**
236
263
  * Creates a URL context tool that gives Google direct access to real-time web content.
237
264
  * Must have name "url_context".
238
265
  */
239
- urlContext: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
266
+ urlContext: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
240
267
  /**
241
268
  * Enables Retrieval Augmented Generation (RAG) via the Gemini File Search tool.
242
269
  * Must have name "file_search".
@@ -252,7 +279,7 @@ declare const googleTools: {
252
279
  fileSearchStoreNames: string[];
253
280
  topK?: number | undefined;
254
281
  metadataFilter?: string | undefined;
255
- }>;
282
+ }, {}>;
256
283
  /**
257
284
  * A tool that enables the model to generate and run Python code.
258
285
  * Must have name "code_execution".
@@ -269,7 +296,7 @@ declare const googleTools: {
269
296
  }, {
270
297
  outcome: string;
271
298
  output: string;
272
- }, {}>;
299
+ }, {}, {}>;
273
300
  /**
274
301
  * Creates a Vertex RAG Store tool that enables the model to perform RAG searches against a Vertex RAG Store.
275
302
  * Must have name "vertex_rag_store".
@@ -277,7 +304,7 @@ declare const googleTools: {
277
304
  vertexRagStore: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
278
305
  ragCorpus: string;
279
306
  topK?: number;
280
- }>;
307
+ }, {}>;
281
308
  };
282
309
 
283
- export { GoogleGenerativeAILanguageModel, type GoogleGenerativeAIModelId, type GroundingMetadataSchema, type SafetyRatingSchema, type UrlContextMetadataSchema, getGroundingMetadataSchema, getUrlContextMetadataSchema, googleTools };
310
+ export { GoogleGenerativeAILanguageModel, type GoogleGenerativeAIModelId, type GroundingMetadataSchema, type PromptFeedbackSchema, type SafetyRatingSchema, type UrlContextMetadataSchema, type UsageMetadataSchema, getGroundingMetadataSchema, getUrlContextMetadataSchema, googleTools };
@@ -1,9 +1,9 @@
1
1
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
2
  import { Resolvable, FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
3
- import { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamResult } from '@ai-sdk/provider';
3
+ import { LanguageModelV4, LanguageModelV4CallOptions, LanguageModelV4GenerateResult, LanguageModelV4StreamResult } 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-exp-image-generation' | '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-lite-preview-09-2025' | '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-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-lite-preview-09-2025' | '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-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;
@@ -14,10 +14,10 @@ type GoogleGenerativeAIConfig = {
14
14
  /**
15
15
  * The supported URLs for the model.
16
16
  */
17
- supportedUrls?: () => LanguageModelV3['supportedUrls'];
17
+ supportedUrls?: () => LanguageModelV4['supportedUrls'];
18
18
  };
19
- declare class GoogleGenerativeAILanguageModel implements LanguageModelV3 {
20
- readonly specificationVersion = "v3";
19
+ declare class GoogleGenerativeAILanguageModel implements LanguageModelV4 {
20
+ readonly specificationVersion = "v4";
21
21
  readonly modelId: GoogleGenerativeAIModelId;
22
22
  private readonly config;
23
23
  private readonly generateId;
@@ -25,8 +25,8 @@ declare class GoogleGenerativeAILanguageModel implements LanguageModelV3 {
25
25
  get provider(): string;
26
26
  get supportedUrls(): Record<string, RegExp[]> | PromiseLike<Record<string, RegExp[]>>;
27
27
  private getArgs;
28
- doGenerate(options: LanguageModelV3CallOptions): Promise<LanguageModelV3GenerateResult>;
29
- doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
28
+ doGenerate(options: LanguageModelV4CallOptions): Promise<LanguageModelV4GenerateResult>;
29
+ doStream(options: LanguageModelV4CallOptions): Promise<LanguageModelV4StreamResult>;
30
30
  }
31
31
  declare const getGroundingMetadataSchema: () => z.ZodObject<{
32
32
  webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
@@ -95,6 +95,21 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
95
95
  mimeType: string;
96
96
  data: string;
97
97
  };
98
+ thought?: boolean | null | undefined;
99
+ thoughtSignature?: string | null | undefined;
100
+ } | {
101
+ toolCall: {
102
+ toolType: string;
103
+ id: string;
104
+ args?: unknown;
105
+ };
106
+ thoughtSignature?: string | null | undefined;
107
+ } | {
108
+ toolResponse: {
109
+ toolType: string;
110
+ id: string;
111
+ response?: unknown;
112
+ };
98
113
  thoughtSignature?: string | null | undefined;
99
114
  } | {
100
115
  executableCode?: {
@@ -111,6 +126,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
111
126
  })[] | null | undefined;
112
127
  } | null | undefined;
113
128
  finishReason?: string | null | undefined;
129
+ finishMessage?: string | null | undefined;
114
130
  safetyRatings?: {
115
131
  category?: string | null | undefined;
116
132
  probability?: string | null | undefined;
@@ -180,6 +196,14 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
180
196
  candidatesTokenCount?: number | null | undefined;
181
197
  totalTokenCount?: number | null | undefined;
182
198
  trafficType?: string | null | undefined;
199
+ promptTokensDetails?: {
200
+ modality: string;
201
+ tokenCount: number;
202
+ }[] | null | undefined;
203
+ candidatesTokensDetails?: {
204
+ modality: string;
205
+ tokenCount: number;
206
+ }[] | null | undefined;
183
207
  } | null | undefined;
184
208
  promptFeedback?: {
185
209
  blockReason?: string | null | undefined;
@@ -192,10 +216,13 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
192
216
  blocked?: boolean | null | undefined;
193
217
  }[] | null | undefined;
194
218
  } | null | undefined;
219
+ serviceTier?: string | null | undefined;
195
220
  }>;
196
221
  type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
197
222
  type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
198
223
  type SafetyRatingSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['safetyRatings']>[number];
224
+ type PromptFeedbackSchema = NonNullable<InferSchema<typeof responseSchema>['promptFeedback']>;
225
+ type UsageMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['usageMetadata']>;
199
226
 
200
227
  declare const googleTools: {
201
228
  /**
@@ -212,7 +239,7 @@ declare const googleTools: {
212
239
  startTime: string;
213
240
  endTime: string;
214
241
  } | undefined;
215
- }>;
242
+ }, {}>;
216
243
  /**
217
244
  * Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
218
245
  * Designed for highly-regulated industries (finance, healthcare, public sector).
@@ -223,7 +250,7 @@ declare const googleTools: {
223
250
  *
224
251
  * @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
225
252
  */
226
- enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
253
+ enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
227
254
  /**
228
255
  * Creates a Google Maps grounding tool that gives the model access to Google Maps data.
229
256
  * Must have name "google_maps".
@@ -231,12 +258,12 @@ declare const googleTools: {
231
258
  * @see https://ai.google.dev/gemini-api/docs/maps-grounding
232
259
  * @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
233
260
  */
234
- googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
261
+ googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
235
262
  /**
236
263
  * Creates a URL context tool that gives Google direct access to real-time web content.
237
264
  * Must have name "url_context".
238
265
  */
239
- urlContext: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
266
+ urlContext: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
240
267
  /**
241
268
  * Enables Retrieval Augmented Generation (RAG) via the Gemini File Search tool.
242
269
  * Must have name "file_search".
@@ -252,7 +279,7 @@ declare const googleTools: {
252
279
  fileSearchStoreNames: string[];
253
280
  topK?: number | undefined;
254
281
  metadataFilter?: string | undefined;
255
- }>;
282
+ }, {}>;
256
283
  /**
257
284
  * A tool that enables the model to generate and run Python code.
258
285
  * Must have name "code_execution".
@@ -269,7 +296,7 @@ declare const googleTools: {
269
296
  }, {
270
297
  outcome: string;
271
298
  output: string;
272
- }, {}>;
299
+ }, {}, {}>;
273
300
  /**
274
301
  * Creates a Vertex RAG Store tool that enables the model to perform RAG searches against a Vertex RAG Store.
275
302
  * Must have name "vertex_rag_store".
@@ -277,7 +304,7 @@ declare const googleTools: {
277
304
  vertexRagStore: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
278
305
  ragCorpus: string;
279
306
  topK?: number;
280
- }>;
307
+ }, {}>;
281
308
  };
282
309
 
283
- export { GoogleGenerativeAILanguageModel, type GoogleGenerativeAIModelId, type GroundingMetadataSchema, type SafetyRatingSchema, type UrlContextMetadataSchema, getGroundingMetadataSchema, getUrlContextMetadataSchema, googleTools };
310
+ export { GoogleGenerativeAILanguageModel, type GoogleGenerativeAIModelId, type GroundingMetadataSchema, type PromptFeedbackSchema, type SafetyRatingSchema, type UrlContextMetadataSchema, type UsageMetadataSchema, getGroundingMetadataSchema, getUrlContextMetadataSchema, googleTools };