@ai-sdk/google 2.0.0-canary.9 → 2.0.0

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,65 +1,9 @@
1
1
  import { LanguageModelV2 } from '@ai-sdk/provider';
2
+ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
3
- import { z } from 'zod';
4
+ import { z } from 'zod/v4';
4
5
 
5
- type GoogleGenerativeAIModelId = 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.5-pro-exp-03-25' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-exp-1206' | 'gemma-3-27b-it' | 'learnlm-1.5-pro-experimental' | (string & {});
6
- interface DynamicRetrievalConfig {
7
- /**
8
- * The mode of the predictor to be used in dynamic retrieval.
9
- */
10
- mode?: 'MODE_UNSPECIFIED' | 'MODE_DYNAMIC';
11
- /**
12
- * The threshold to be used in dynamic retrieval. If not set, a system default
13
- * value is used.
14
- */
15
- dynamicThreshold?: number;
16
- }
17
- interface GoogleGenerativeAISettings {
18
- /**
19
- Optional.
20
- The name of the cached content used as context to serve the prediction.
21
- Format: cachedContents/{cachedContent}
22
- */
23
- cachedContent?: string;
24
- /**
25
- * Optional. Enable structured output. Default is true.
26
- *
27
- * This is useful when the JSON Schema contains elements that are
28
- * not supported by the OpenAPI schema version that
29
- * Google Generative AI uses. You can use this to disable
30
- * structured outputs if you need to.
31
- */
32
- structuredOutputs?: boolean;
33
- /**
34
- Optional. A list of unique safety settings for blocking unsafe content.
35
- */
36
- safetySettings?: Array<{
37
- category: 'HARM_CATEGORY_UNSPECIFIED' | 'HARM_CATEGORY_HATE_SPEECH' | 'HARM_CATEGORY_DANGEROUS_CONTENT' | 'HARM_CATEGORY_HARASSMENT' | 'HARM_CATEGORY_SEXUALLY_EXPLICIT' | 'HARM_CATEGORY_CIVIC_INTEGRITY';
38
- threshold: 'HARM_BLOCK_THRESHOLD_UNSPECIFIED' | 'BLOCK_LOW_AND_ABOVE' | 'BLOCK_MEDIUM_AND_ABOVE' | 'BLOCK_ONLY_HIGH' | 'BLOCK_NONE' | 'OFF';
39
- }>;
40
- /**
41
- * Optional. Enables timestamp understanding for audio-only files.
42
- *
43
- * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
44
- */
45
- audioTimestamp?: boolean;
46
- /**
47
- Optional. When enabled, the model will use Google search to ground the response.
48
-
49
- @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/overview
50
- */
51
- useSearchGrounding?: boolean;
52
- /**
53
- Optional. Specifies the dynamic retrieval configuration.
54
-
55
- @note Dynamic retrieval is only compatible with Gemini 1.5 Flash.
56
-
57
- @see https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/ground-with-google-search#dynamic-retrieval
58
- */
59
- dynamicRetrievalConfig?: DynamicRetrievalConfig;
60
- }
61
- interface InternalGoogleGenerativeAISettings extends GoogleGenerativeAISettings {
62
- }
6
+ type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.5-pro-exp-03-25' | 'gemini-2.5-flash-preview-04-17' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
63
7
 
64
8
  type GoogleGenerativeAIConfig = {
65
9
  provider: string;
@@ -67,214 +11,63 @@ type GoogleGenerativeAIConfig = {
67
11
  headers: Resolvable<Record<string, string | undefined>>;
68
12
  fetch?: FetchFunction;
69
13
  generateId: () => string;
70
- isSupportedUrl: (url: URL) => boolean;
14
+ /**
15
+ * The supported URLs for the model.
16
+ */
17
+ supportedUrls?: () => LanguageModelV2['supportedUrls'];
71
18
  };
72
19
  declare class GoogleGenerativeAILanguageModel implements LanguageModelV2 {
73
20
  readonly specificationVersion = "v2";
74
- readonly defaultObjectGenerationMode = "json";
75
- readonly supportsImageUrls = false;
76
- get supportsStructuredOutputs(): boolean;
77
21
  readonly modelId: GoogleGenerativeAIModelId;
78
- readonly settings: InternalGoogleGenerativeAISettings;
79
22
  private readonly config;
80
- constructor(modelId: GoogleGenerativeAIModelId, settings: InternalGoogleGenerativeAISettings, config: GoogleGenerativeAIConfig);
23
+ private readonly generateId;
24
+ constructor(modelId: GoogleGenerativeAIModelId, config: GoogleGenerativeAIConfig);
81
25
  get provider(): string;
26
+ get supportedUrls(): Record<string, RegExp[]> | PromiseLike<Record<string, RegExp[]>>;
82
27
  private getArgs;
83
- supportsUrl(url: URL): boolean;
84
28
  doGenerate(options: Parameters<LanguageModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
85
29
  doStream(options: Parameters<LanguageModelV2['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
86
30
  }
87
- declare const groundingMetadataSchema: z.ZodObject<{
88
- webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
89
- retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
90
- searchEntryPoint: z.ZodOptional<z.ZodNullable<z.ZodObject<{
91
- renderedContent: z.ZodString;
92
- }, "strip", z.ZodTypeAny, {
93
- renderedContent: string;
94
- }, {
95
- renderedContent: string;
96
- }>>>;
97
- groundingChunks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
98
- web: z.ZodOptional<z.ZodNullable<z.ZodObject<{
99
- uri: z.ZodString;
100
- title: z.ZodString;
101
- }, "strip", z.ZodTypeAny, {
102
- uri: string;
103
- title: string;
104
- }, {
105
- uri: string;
106
- title: string;
107
- }>>>;
108
- retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
109
- uri: z.ZodString;
110
- title: z.ZodString;
111
- }, "strip", z.ZodTypeAny, {
112
- uri: string;
113
- title: string;
114
- }, {
115
- uri: string;
116
- title: string;
117
- }>>>;
118
- }, "strip", z.ZodTypeAny, {
119
- web?: {
120
- uri: string;
121
- title: string;
122
- } | null | undefined;
123
- retrievedContext?: {
124
- uri: string;
125
- title: string;
126
- } | null | undefined;
127
- }, {
128
- web?: {
129
- uri: string;
130
- title: string;
131
- } | null | undefined;
132
- retrievedContext?: {
133
- uri: string;
134
- title: string;
135
- } | null | undefined;
136
- }>, "many">>>;
137
- groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
138
- segment: z.ZodObject<{
139
- startIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
140
- endIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
141
- text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
142
- }, "strip", z.ZodTypeAny, {
143
- startIndex?: number | null | undefined;
144
- endIndex?: number | null | undefined;
145
- text?: string | null | undefined;
146
- }, {
147
- startIndex?: number | null | undefined;
148
- endIndex?: number | null | undefined;
149
- text?: string | null | undefined;
150
- }>;
151
- segment_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
152
- groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
153
- supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
154
- confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
155
- confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
156
- }, "strip", z.ZodTypeAny, {
157
- segment: {
158
- startIndex?: number | null | undefined;
159
- endIndex?: number | null | undefined;
160
- text?: string | null | undefined;
161
- };
162
- segment_text?: string | null | undefined;
163
- groundingChunkIndices?: number[] | null | undefined;
164
- supportChunkIndices?: number[] | null | undefined;
165
- confidenceScores?: number[] | null | undefined;
166
- confidenceScore?: number[] | null | undefined;
167
- }, {
168
- segment: {
169
- startIndex?: number | null | undefined;
170
- endIndex?: number | null | undefined;
171
- text?: string | null | undefined;
172
- };
173
- segment_text?: string | null | undefined;
174
- groundingChunkIndices?: number[] | null | undefined;
175
- supportChunkIndices?: number[] | null | undefined;
176
- confidenceScores?: number[] | null | undefined;
177
- confidenceScore?: number[] | null | undefined;
178
- }>, "many">>>;
179
- retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodObject<{
180
- webDynamicRetrievalScore: z.ZodNumber;
181
- }, "strip", z.ZodTypeAny, {
182
- webDynamicRetrievalScore: number;
183
- }, {
184
- webDynamicRetrievalScore: number;
185
- }>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>>;
186
- }, "strip", z.ZodTypeAny, {
187
- webSearchQueries?: string[] | null | undefined;
188
- retrievalQueries?: string[] | null | undefined;
189
- searchEntryPoint?: {
190
- renderedContent: string;
191
- } | null | undefined;
192
- groundingChunks?: {
193
- web?: {
194
- uri: string;
195
- title: string;
196
- } | null | undefined;
197
- retrievedContext?: {
198
- uri: string;
199
- title: string;
200
- } | null | undefined;
201
- }[] | null | undefined;
202
- groundingSupports?: {
203
- segment: {
204
- startIndex?: number | null | undefined;
205
- endIndex?: number | null | undefined;
206
- text?: string | null | undefined;
207
- };
208
- segment_text?: string | null | undefined;
209
- groundingChunkIndices?: number[] | null | undefined;
210
- supportChunkIndices?: number[] | null | undefined;
211
- confidenceScores?: number[] | null | undefined;
212
- confidenceScore?: number[] | null | undefined;
213
- }[] | null | undefined;
214
- retrievalMetadata?: {
215
- webDynamicRetrievalScore: number;
216
- } | {} | null | undefined;
217
- }, {
218
- webSearchQueries?: string[] | null | undefined;
219
- retrievalQueries?: string[] | null | undefined;
220
- searchEntryPoint?: {
221
- renderedContent: string;
222
- } | null | undefined;
223
- groundingChunks?: {
224
- web?: {
225
- uri: string;
226
- title: string;
227
- } | null | undefined;
228
- retrievedContext?: {
229
- uri: string;
230
- title: string;
231
- } | null | undefined;
232
- }[] | null | undefined;
233
- groundingSupports?: {
234
- segment: {
235
- startIndex?: number | null | undefined;
236
- endIndex?: number | null | undefined;
237
- text?: string | null | undefined;
238
- };
239
- segment_text?: string | null | undefined;
240
- groundingChunkIndices?: number[] | null | undefined;
241
- supportChunkIndices?: number[] | null | undefined;
242
- confidenceScores?: number[] | null | undefined;
243
- confidenceScore?: number[] | null | undefined;
244
- }[] | null | undefined;
245
- retrievalMetadata?: {
246
- webDynamicRetrievalScore: number;
247
- } | {} | null | undefined;
248
- }>;
249
31
  declare const safetyRatingSchema: z.ZodObject<{
250
- category: z.ZodString;
251
- probability: z.ZodString;
32
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
+ probability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
252
34
  probabilityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
253
35
  severity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
254
36
  severityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
255
37
  blocked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
256
- }, "strip", z.ZodTypeAny, {
257
- category: string;
258
- probability: string;
259
- probabilityScore?: number | null | undefined;
260
- severity?: string | null | undefined;
261
- severityScore?: number | null | undefined;
262
- blocked?: boolean | null | undefined;
263
- }, {
264
- category: string;
265
- probability: string;
266
- probabilityScore?: number | null | undefined;
267
- severity?: string | null | undefined;
268
- severityScore?: number | null | undefined;
269
- blocked?: boolean | null | undefined;
270
- }>;
271
- declare const googleGenerativeAIProviderOptionsSchema: z.ZodObject<{
272
- responseModalities: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<["TEXT", "IMAGE"]>, "many">>>;
273
- }, "strip", z.ZodTypeAny, {
274
- responseModalities?: ("TEXT" | "IMAGE")[] | null | undefined;
275
- }, {
276
- responseModalities?: ("TEXT" | "IMAGE")[] | null | undefined;
277
- }>;
278
- type GoogleGenerativeAIProviderOptions = z.infer<typeof googleGenerativeAIProviderOptionsSchema>;
38
+ }, z.core.$strip>;
39
+
40
+ declare const googleTools: {
41
+ /**
42
+ * Creates a Google search tool that gives Google direct access to real-time web content.
43
+ * Must have name "google_search".
44
+ */
45
+ googleSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
46
+ mode?: "MODE_DYNAMIC" | "MODE_UNSPECIFIED";
47
+ dynamicThreshold?: number;
48
+ }>;
49
+ /**
50
+ * Creates a URL context tool that gives Google direct access to real-time web content.
51
+ * Must have name "url_context".
52
+ */
53
+ urlContext: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {}>;
54
+ /**
55
+ * A tool that enables the model to generate and run Python code.
56
+ * Must have name "code_execution".
57
+ *
58
+ * @note Ensure the selected model supports Code Execution.
59
+ * Multi-tool usage with the code execution tool is typically compatible with Gemini >=2 models.
60
+ *
61
+ * @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)
62
+ * @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)
63
+ */
64
+ codeExecution: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
65
+ language: string;
66
+ code: string;
67
+ }, {
68
+ outcome: string;
69
+ output: string;
70
+ }, {}>;
71
+ };
279
72
 
280
- export { GoogleGenerativeAILanguageModel, type GoogleGenerativeAIProviderOptions, type InternalGoogleGenerativeAISettings, groundingMetadataSchema, safetyRatingSchema };
73
+ export { GoogleGenerativeAILanguageModel, type GoogleGenerativeAIModelId, googleTools, safetyRatingSchema };
@@ -1,65 +1,9 @@
1
1
  import { LanguageModelV2 } from '@ai-sdk/provider';
2
+ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
3
- import { z } from 'zod';
4
+ import { z } from 'zod/v4';
4
5
 
5
- type GoogleGenerativeAIModelId = 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.5-pro-exp-03-25' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-exp-1206' | 'gemma-3-27b-it' | 'learnlm-1.5-pro-experimental' | (string & {});
6
- interface DynamicRetrievalConfig {
7
- /**
8
- * The mode of the predictor to be used in dynamic retrieval.
9
- */
10
- mode?: 'MODE_UNSPECIFIED' | 'MODE_DYNAMIC';
11
- /**
12
- * The threshold to be used in dynamic retrieval. If not set, a system default
13
- * value is used.
14
- */
15
- dynamicThreshold?: number;
16
- }
17
- interface GoogleGenerativeAISettings {
18
- /**
19
- Optional.
20
- The name of the cached content used as context to serve the prediction.
21
- Format: cachedContents/{cachedContent}
22
- */
23
- cachedContent?: string;
24
- /**
25
- * Optional. Enable structured output. Default is true.
26
- *
27
- * This is useful when the JSON Schema contains elements that are
28
- * not supported by the OpenAPI schema version that
29
- * Google Generative AI uses. You can use this to disable
30
- * structured outputs if you need to.
31
- */
32
- structuredOutputs?: boolean;
33
- /**
34
- Optional. A list of unique safety settings for blocking unsafe content.
35
- */
36
- safetySettings?: Array<{
37
- category: 'HARM_CATEGORY_UNSPECIFIED' | 'HARM_CATEGORY_HATE_SPEECH' | 'HARM_CATEGORY_DANGEROUS_CONTENT' | 'HARM_CATEGORY_HARASSMENT' | 'HARM_CATEGORY_SEXUALLY_EXPLICIT' | 'HARM_CATEGORY_CIVIC_INTEGRITY';
38
- threshold: 'HARM_BLOCK_THRESHOLD_UNSPECIFIED' | 'BLOCK_LOW_AND_ABOVE' | 'BLOCK_MEDIUM_AND_ABOVE' | 'BLOCK_ONLY_HIGH' | 'BLOCK_NONE' | 'OFF';
39
- }>;
40
- /**
41
- * Optional. Enables timestamp understanding for audio-only files.
42
- *
43
- * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
44
- */
45
- audioTimestamp?: boolean;
46
- /**
47
- Optional. When enabled, the model will use Google search to ground the response.
48
-
49
- @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/overview
50
- */
51
- useSearchGrounding?: boolean;
52
- /**
53
- Optional. Specifies the dynamic retrieval configuration.
54
-
55
- @note Dynamic retrieval is only compatible with Gemini 1.5 Flash.
56
-
57
- @see https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/ground-with-google-search#dynamic-retrieval
58
- */
59
- dynamicRetrievalConfig?: DynamicRetrievalConfig;
60
- }
61
- interface InternalGoogleGenerativeAISettings extends GoogleGenerativeAISettings {
62
- }
6
+ type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.5-pro-exp-03-25' | 'gemini-2.5-flash-preview-04-17' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
63
7
 
64
8
  type GoogleGenerativeAIConfig = {
65
9
  provider: string;
@@ -67,214 +11,63 @@ type GoogleGenerativeAIConfig = {
67
11
  headers: Resolvable<Record<string, string | undefined>>;
68
12
  fetch?: FetchFunction;
69
13
  generateId: () => string;
70
- isSupportedUrl: (url: URL) => boolean;
14
+ /**
15
+ * The supported URLs for the model.
16
+ */
17
+ supportedUrls?: () => LanguageModelV2['supportedUrls'];
71
18
  };
72
19
  declare class GoogleGenerativeAILanguageModel implements LanguageModelV2 {
73
20
  readonly specificationVersion = "v2";
74
- readonly defaultObjectGenerationMode = "json";
75
- readonly supportsImageUrls = false;
76
- get supportsStructuredOutputs(): boolean;
77
21
  readonly modelId: GoogleGenerativeAIModelId;
78
- readonly settings: InternalGoogleGenerativeAISettings;
79
22
  private readonly config;
80
- constructor(modelId: GoogleGenerativeAIModelId, settings: InternalGoogleGenerativeAISettings, config: GoogleGenerativeAIConfig);
23
+ private readonly generateId;
24
+ constructor(modelId: GoogleGenerativeAIModelId, config: GoogleGenerativeAIConfig);
81
25
  get provider(): string;
26
+ get supportedUrls(): Record<string, RegExp[]> | PromiseLike<Record<string, RegExp[]>>;
82
27
  private getArgs;
83
- supportsUrl(url: URL): boolean;
84
28
  doGenerate(options: Parameters<LanguageModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
85
29
  doStream(options: Parameters<LanguageModelV2['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
86
30
  }
87
- declare const groundingMetadataSchema: z.ZodObject<{
88
- webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
89
- retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
90
- searchEntryPoint: z.ZodOptional<z.ZodNullable<z.ZodObject<{
91
- renderedContent: z.ZodString;
92
- }, "strip", z.ZodTypeAny, {
93
- renderedContent: string;
94
- }, {
95
- renderedContent: string;
96
- }>>>;
97
- groundingChunks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
98
- web: z.ZodOptional<z.ZodNullable<z.ZodObject<{
99
- uri: z.ZodString;
100
- title: z.ZodString;
101
- }, "strip", z.ZodTypeAny, {
102
- uri: string;
103
- title: string;
104
- }, {
105
- uri: string;
106
- title: string;
107
- }>>>;
108
- retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
109
- uri: z.ZodString;
110
- title: z.ZodString;
111
- }, "strip", z.ZodTypeAny, {
112
- uri: string;
113
- title: string;
114
- }, {
115
- uri: string;
116
- title: string;
117
- }>>>;
118
- }, "strip", z.ZodTypeAny, {
119
- web?: {
120
- uri: string;
121
- title: string;
122
- } | null | undefined;
123
- retrievedContext?: {
124
- uri: string;
125
- title: string;
126
- } | null | undefined;
127
- }, {
128
- web?: {
129
- uri: string;
130
- title: string;
131
- } | null | undefined;
132
- retrievedContext?: {
133
- uri: string;
134
- title: string;
135
- } | null | undefined;
136
- }>, "many">>>;
137
- groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
138
- segment: z.ZodObject<{
139
- startIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
140
- endIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
141
- text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
142
- }, "strip", z.ZodTypeAny, {
143
- startIndex?: number | null | undefined;
144
- endIndex?: number | null | undefined;
145
- text?: string | null | undefined;
146
- }, {
147
- startIndex?: number | null | undefined;
148
- endIndex?: number | null | undefined;
149
- text?: string | null | undefined;
150
- }>;
151
- segment_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
152
- groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
153
- supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
154
- confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
155
- confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
156
- }, "strip", z.ZodTypeAny, {
157
- segment: {
158
- startIndex?: number | null | undefined;
159
- endIndex?: number | null | undefined;
160
- text?: string | null | undefined;
161
- };
162
- segment_text?: string | null | undefined;
163
- groundingChunkIndices?: number[] | null | undefined;
164
- supportChunkIndices?: number[] | null | undefined;
165
- confidenceScores?: number[] | null | undefined;
166
- confidenceScore?: number[] | null | undefined;
167
- }, {
168
- segment: {
169
- startIndex?: number | null | undefined;
170
- endIndex?: number | null | undefined;
171
- text?: string | null | undefined;
172
- };
173
- segment_text?: string | null | undefined;
174
- groundingChunkIndices?: number[] | null | undefined;
175
- supportChunkIndices?: number[] | null | undefined;
176
- confidenceScores?: number[] | null | undefined;
177
- confidenceScore?: number[] | null | undefined;
178
- }>, "many">>>;
179
- retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodObject<{
180
- webDynamicRetrievalScore: z.ZodNumber;
181
- }, "strip", z.ZodTypeAny, {
182
- webDynamicRetrievalScore: number;
183
- }, {
184
- webDynamicRetrievalScore: number;
185
- }>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>>;
186
- }, "strip", z.ZodTypeAny, {
187
- webSearchQueries?: string[] | null | undefined;
188
- retrievalQueries?: string[] | null | undefined;
189
- searchEntryPoint?: {
190
- renderedContent: string;
191
- } | null | undefined;
192
- groundingChunks?: {
193
- web?: {
194
- uri: string;
195
- title: string;
196
- } | null | undefined;
197
- retrievedContext?: {
198
- uri: string;
199
- title: string;
200
- } | null | undefined;
201
- }[] | null | undefined;
202
- groundingSupports?: {
203
- segment: {
204
- startIndex?: number | null | undefined;
205
- endIndex?: number | null | undefined;
206
- text?: string | null | undefined;
207
- };
208
- segment_text?: string | null | undefined;
209
- groundingChunkIndices?: number[] | null | undefined;
210
- supportChunkIndices?: number[] | null | undefined;
211
- confidenceScores?: number[] | null | undefined;
212
- confidenceScore?: number[] | null | undefined;
213
- }[] | null | undefined;
214
- retrievalMetadata?: {
215
- webDynamicRetrievalScore: number;
216
- } | {} | null | undefined;
217
- }, {
218
- webSearchQueries?: string[] | null | undefined;
219
- retrievalQueries?: string[] | null | undefined;
220
- searchEntryPoint?: {
221
- renderedContent: string;
222
- } | null | undefined;
223
- groundingChunks?: {
224
- web?: {
225
- uri: string;
226
- title: string;
227
- } | null | undefined;
228
- retrievedContext?: {
229
- uri: string;
230
- title: string;
231
- } | null | undefined;
232
- }[] | null | undefined;
233
- groundingSupports?: {
234
- segment: {
235
- startIndex?: number | null | undefined;
236
- endIndex?: number | null | undefined;
237
- text?: string | null | undefined;
238
- };
239
- segment_text?: string | null | undefined;
240
- groundingChunkIndices?: number[] | null | undefined;
241
- supportChunkIndices?: number[] | null | undefined;
242
- confidenceScores?: number[] | null | undefined;
243
- confidenceScore?: number[] | null | undefined;
244
- }[] | null | undefined;
245
- retrievalMetadata?: {
246
- webDynamicRetrievalScore: number;
247
- } | {} | null | undefined;
248
- }>;
249
31
  declare const safetyRatingSchema: z.ZodObject<{
250
- category: z.ZodString;
251
- probability: z.ZodString;
32
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
+ probability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
252
34
  probabilityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
253
35
  severity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
254
36
  severityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
255
37
  blocked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
256
- }, "strip", z.ZodTypeAny, {
257
- category: string;
258
- probability: string;
259
- probabilityScore?: number | null | undefined;
260
- severity?: string | null | undefined;
261
- severityScore?: number | null | undefined;
262
- blocked?: boolean | null | undefined;
263
- }, {
264
- category: string;
265
- probability: string;
266
- probabilityScore?: number | null | undefined;
267
- severity?: string | null | undefined;
268
- severityScore?: number | null | undefined;
269
- blocked?: boolean | null | undefined;
270
- }>;
271
- declare const googleGenerativeAIProviderOptionsSchema: z.ZodObject<{
272
- responseModalities: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<["TEXT", "IMAGE"]>, "many">>>;
273
- }, "strip", z.ZodTypeAny, {
274
- responseModalities?: ("TEXT" | "IMAGE")[] | null | undefined;
275
- }, {
276
- responseModalities?: ("TEXT" | "IMAGE")[] | null | undefined;
277
- }>;
278
- type GoogleGenerativeAIProviderOptions = z.infer<typeof googleGenerativeAIProviderOptionsSchema>;
38
+ }, z.core.$strip>;
39
+
40
+ declare const googleTools: {
41
+ /**
42
+ * Creates a Google search tool that gives Google direct access to real-time web content.
43
+ * Must have name "google_search".
44
+ */
45
+ googleSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
46
+ mode?: "MODE_DYNAMIC" | "MODE_UNSPECIFIED";
47
+ dynamicThreshold?: number;
48
+ }>;
49
+ /**
50
+ * Creates a URL context tool that gives Google direct access to real-time web content.
51
+ * Must have name "url_context".
52
+ */
53
+ urlContext: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {}>;
54
+ /**
55
+ * A tool that enables the model to generate and run Python code.
56
+ * Must have name "code_execution".
57
+ *
58
+ * @note Ensure the selected model supports Code Execution.
59
+ * Multi-tool usage with the code execution tool is typically compatible with Gemini >=2 models.
60
+ *
61
+ * @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)
62
+ * @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)
63
+ */
64
+ codeExecution: _ai_sdk_provider_utils.ProviderDefinedToolFactoryWithOutputSchema<{
65
+ language: string;
66
+ code: string;
67
+ }, {
68
+ outcome: string;
69
+ output: string;
70
+ }, {}>;
71
+ };
279
72
 
280
- export { GoogleGenerativeAILanguageModel, type GoogleGenerativeAIProviderOptions, type InternalGoogleGenerativeAISettings, groundingMetadataSchema, safetyRatingSchema };
73
+ export { GoogleGenerativeAILanguageModel, type GoogleGenerativeAIModelId, googleTools, safetyRatingSchema };