@ai-sdk/google 2.0.0-alpha.9 → 2.0.0-beta.10

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 CHANGED
@@ -1,5 +1,147 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 2.0.0-beta.10
4
+
5
+ ### Patch Changes
6
+
7
+ - 7badba2: fix(google): grounding streaming sources
8
+ - Updated dependencies [05d2819]
9
+ - @ai-sdk/provider-utils@3.0.0-beta.3
10
+
11
+ ## 2.0.0-beta.9
12
+
13
+ ### Patch Changes
14
+
15
+ - 8af9e03: Added Image Models to the Google Provider for Imagen 3 Support
16
+
17
+ ## 2.0.0-beta.8
18
+
19
+ ### Patch Changes
20
+
21
+ - 2e06f14: feat (provider/google): Change to provider defined tools
22
+
23
+ - Change the google search tool to be a provider defined tool
24
+ - Added new URL context tool as a provider defined tool
25
+
26
+ ## 2.0.0-beta.7
27
+
28
+ ### Patch Changes
29
+
30
+ - 19a4336: Expose raw usageMetadata returned from Google Generative AI in providerMetadata
31
+
32
+ ## 2.0.0-beta.6
33
+
34
+ ### Patch Changes
35
+
36
+ - 878bf45: removes (unsupported) `additionalProperties` from the Schema sent in the request payloads to Google APIs
37
+
38
+ ## 2.0.0-beta.5
39
+
40
+ ### Patch Changes
41
+
42
+ - 42fcd32: feat(google): automatically handle system instructions for Gemma models
43
+
44
+ ## 2.0.0-beta.4
45
+
46
+ ### Patch Changes
47
+
48
+ - c68931f: Support tool schemas that allow additional properties (e.g `z.record(z.string())`)
49
+ - 8e6b69d: feat(providers/google): Add support for Gemini 2.5 Pro and Gemini 2.5 Flash (now stable)
50
+
51
+ ## 2.0.0-beta.3
52
+
53
+ ### Patch Changes
54
+
55
+ - cb787ac: fix: remove non-functional models
56
+ - d1a034f: feature: using Zod 4 for internal stuff
57
+ - Updated dependencies [0571b98]
58
+ - Updated dependencies [39a4fab]
59
+ - Updated dependencies [d1a034f]
60
+ - @ai-sdk/provider-utils@3.0.0-beta.2
61
+
62
+ ## 2.0.0-beta.2
63
+
64
+ ### Patch Changes
65
+
66
+ - a313780: fix: omit system message for gemma models
67
+
68
+ ## 2.0.0-beta.1
69
+
70
+ ### Patch Changes
71
+
72
+ - Updated dependencies [742b7be]
73
+ - Updated dependencies [7cddb72]
74
+ - Updated dependencies [ccce59b]
75
+ - Updated dependencies [e2b9e4b]
76
+ - Updated dependencies [45c1ea2]
77
+ - Updated dependencies [e025824]
78
+ - Updated dependencies [0d06df6]
79
+ - Updated dependencies [472524a]
80
+ - Updated dependencies [dd3ff01]
81
+ - Updated dependencies [7435eb5]
82
+ - Updated dependencies [cb68df0]
83
+ - Updated dependencies [bfdca8d]
84
+ - Updated dependencies [44f4aba]
85
+ - Updated dependencies [023ba40]
86
+ - Updated dependencies [5e57fae]
87
+ - Updated dependencies [71f938d]
88
+ - Updated dependencies [28a5ed5]
89
+ - @ai-sdk/provider@2.0.0-beta.1
90
+ - @ai-sdk/provider-utils@3.0.0-beta.1
91
+
92
+ ## 2.0.0-alpha.15
93
+
94
+ ### Patch Changes
95
+
96
+ - Updated dependencies [48d257a]
97
+ - Updated dependencies [8ba77a7]
98
+ - @ai-sdk/provider@2.0.0-alpha.15
99
+ - @ai-sdk/provider-utils@3.0.0-alpha.15
100
+
101
+ ## 2.0.0-alpha.14
102
+
103
+ ### Patch Changes
104
+
105
+ - Updated dependencies [b5da06a]
106
+ - Updated dependencies [63f9e9b]
107
+ - Updated dependencies [2e13791]
108
+ - @ai-sdk/provider@2.0.0-alpha.14
109
+ - @ai-sdk/provider-utils@3.0.0-alpha.14
110
+
111
+ ## 2.0.0-alpha.13
112
+
113
+ ### Patch Changes
114
+
115
+ - Updated dependencies [68ecf2f]
116
+ - @ai-sdk/provider@2.0.0-alpha.13
117
+ - @ai-sdk/provider-utils@3.0.0-alpha.13
118
+
119
+ ## 2.0.0-alpha.12
120
+
121
+ ### Patch Changes
122
+
123
+ - e2aceaf: feat: add raw chunk support
124
+ - Updated dependencies [e2aceaf]
125
+ - @ai-sdk/provider@2.0.0-alpha.12
126
+ - @ai-sdk/provider-utils@3.0.0-alpha.12
127
+
128
+ ## 2.0.0-alpha.11
129
+
130
+ ### Patch Changes
131
+
132
+ - Updated dependencies [c1e6647]
133
+ - @ai-sdk/provider@2.0.0-alpha.11
134
+ - @ai-sdk/provider-utils@3.0.0-alpha.11
135
+
136
+ ## 2.0.0-alpha.10
137
+
138
+ ### Patch Changes
139
+
140
+ - 581a9be: fix (provider/google): prevent error when thinking signature is used
141
+ - Updated dependencies [c4df419]
142
+ - @ai-sdk/provider@2.0.0-alpha.10
143
+ - @ai-sdk/provider-utils@3.0.0-alpha.10
144
+
3
145
  ## 2.0.0-alpha.9
4
146
 
5
147
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
- import { z } from 'zod';
2
- import { ProviderV2, LanguageModelV2, EmbeddingModelV2 } from '@ai-sdk/provider';
1
+ import { z } from 'zod/v4';
2
+ import { ProviderV2, LanguageModelV2, ImageModelV2, EmbeddingModelV2 } from '@ai-sdk/provider';
3
+ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
4
  import { FetchFunction } from '@ai-sdk/provider-utils';
4
5
 
5
6
  declare const googleErrorDataSchema: z.ZodObject<{
@@ -7,306 +8,92 @@ declare const googleErrorDataSchema: z.ZodObject<{
7
8
  code: z.ZodNullable<z.ZodNumber>;
8
9
  message: z.ZodString;
9
10
  status: z.ZodString;
10
- }, "strip", z.ZodTypeAny, {
11
- code: number | null;
12
- message: string;
13
- status: string;
14
- }, {
15
- code: number | null;
16
- message: string;
17
- status: string;
18
- }>;
19
- }, "strip", z.ZodTypeAny, {
20
- error: {
21
- code: number | null;
22
- message: string;
23
- status: string;
24
- };
25
- }, {
26
- error: {
27
- code: number | null;
28
- message: string;
29
- status: string;
30
- };
31
- }>;
11
+ }, z.core.$strip>;
12
+ }, z.core.$strip>;
32
13
  type GoogleErrorData = z.infer<typeof googleErrorDataSchema>;
33
14
 
34
- 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-exp-03-25' | 'gemini-2.5-flash-preview-04-17' | 'gemini-exp-1206' | 'gemma-3-27b-it' | 'learnlm-1.5-pro-experimental' | (string & {});
15
+ 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-pro-exp-03-25' | 'gemini-2.5-flash-preview-04-17' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
35
16
  declare const googleGenerativeAIProviderOptions: z.ZodObject<{
36
- responseModalities: z.ZodOptional<z.ZodArray<z.ZodEnum<["TEXT", "IMAGE"]>, "many">>;
17
+ responseModalities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
18
+ TEXT: "TEXT";
19
+ IMAGE: "IMAGE";
20
+ }>>>;
37
21
  thinkingConfig: z.ZodOptional<z.ZodObject<{
38
22
  thinkingBudget: z.ZodOptional<z.ZodNumber>;
39
- }, "strip", z.ZodTypeAny, {
40
- thinkingBudget?: number | undefined;
41
- }, {
42
- thinkingBudget?: number | undefined;
43
- }>>;
44
- /**
45
- Optional.
46
- The name of the cached content used as context to serve the prediction.
47
- Format: cachedContents/{cachedContent}
48
- */
23
+ includeThoughts: z.ZodOptional<z.ZodBoolean>;
24
+ }, z.core.$strip>>;
49
25
  cachedContent: z.ZodOptional<z.ZodString>;
50
- /**
51
- * Optional. Enable structured output. Default is true.
52
- *
53
- * This is useful when the JSON Schema contains elements that are
54
- * not supported by the OpenAPI schema version that
55
- * Google Generative AI uses. You can use this to disable
56
- * structured outputs if you need to.
57
- */
58
26
  structuredOutputs: z.ZodOptional<z.ZodBoolean>;
59
- /**
60
- Optional. A list of unique safety settings for blocking unsafe content.
61
- */
62
27
  safetySettings: z.ZodOptional<z.ZodArray<z.ZodObject<{
63
- category: z.ZodEnum<["HARM_CATEGORY_UNSPECIFIED", "HARM_CATEGORY_HATE_SPEECH", "HARM_CATEGORY_DANGEROUS_CONTENT", "HARM_CATEGORY_HARASSMENT", "HARM_CATEGORY_SEXUALLY_EXPLICIT", "HARM_CATEGORY_CIVIC_INTEGRITY"]>;
64
- threshold: z.ZodEnum<["HARM_BLOCK_THRESHOLD_UNSPECIFIED", "BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE", "OFF"]>;
65
- }, "strip", z.ZodTypeAny, {
66
- category: "HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
67
- threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
68
- }, {
69
- category: "HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
70
- threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
71
- }>, "many">>;
72
- threshold: z.ZodOptional<z.ZodEnum<["HARM_BLOCK_THRESHOLD_UNSPECIFIED", "BLOCK_LOW_AND_ABOVE", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_ONLY_HIGH", "BLOCK_NONE", "OFF"]>>;
73
- /**
74
- * Optional. Enables timestamp understanding for audio-only files.
75
- *
76
- * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
77
- */
78
- audioTimestamp: z.ZodOptional<z.ZodBoolean>;
79
- /**
80
- Optional. When enabled, the model will use Google search to ground the response.
81
-
82
- @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/overview
83
- */
84
- useSearchGrounding: z.ZodOptional<z.ZodBoolean>;
85
- /**
86
- Optional. Specifies the dynamic retrieval configuration.
87
-
88
- @note Dynamic retrieval is only compatible with Gemini 1.5 Flash.
89
-
90
- @see https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/ground-with-google-search#dynamic-retrieval
91
- */
92
- dynamicRetrievalConfig: z.ZodOptional<z.ZodObject<{
93
- /**
94
- * The mode of the predictor to be used in dynamic retrieval.
95
- */
96
- mode: z.ZodOptional<z.ZodEnum<["MODE_UNSPECIFIED", "MODE_DYNAMIC"]>>;
97
- /**
98
- * The threshold to be used in dynamic retrieval. If not set, a system default
99
- * value is used.
100
- */
101
- dynamicThreshold: z.ZodOptional<z.ZodNumber>;
102
- }, "strip", z.ZodTypeAny, {
103
- mode?: "MODE_UNSPECIFIED" | "MODE_DYNAMIC" | undefined;
104
- dynamicThreshold?: number | undefined;
105
- }, {
106
- mode?: "MODE_UNSPECIFIED" | "MODE_DYNAMIC" | undefined;
107
- dynamicThreshold?: number | undefined;
28
+ category: z.ZodEnum<{
29
+ HARM_CATEGORY_UNSPECIFIED: "HARM_CATEGORY_UNSPECIFIED";
30
+ HARM_CATEGORY_HATE_SPEECH: "HARM_CATEGORY_HATE_SPEECH";
31
+ HARM_CATEGORY_DANGEROUS_CONTENT: "HARM_CATEGORY_DANGEROUS_CONTENT";
32
+ HARM_CATEGORY_HARASSMENT: "HARM_CATEGORY_HARASSMENT";
33
+ HARM_CATEGORY_SEXUALLY_EXPLICIT: "HARM_CATEGORY_SEXUALLY_EXPLICIT";
34
+ HARM_CATEGORY_CIVIC_INTEGRITY: "HARM_CATEGORY_CIVIC_INTEGRITY";
35
+ }>;
36
+ threshold: z.ZodEnum<{
37
+ HARM_BLOCK_THRESHOLD_UNSPECIFIED: "HARM_BLOCK_THRESHOLD_UNSPECIFIED";
38
+ BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
39
+ BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
40
+ BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
41
+ BLOCK_NONE: "BLOCK_NONE";
42
+ OFF: "OFF";
43
+ }>;
44
+ }, z.core.$strip>>>;
45
+ threshold: z.ZodOptional<z.ZodEnum<{
46
+ HARM_BLOCK_THRESHOLD_UNSPECIFIED: "HARM_BLOCK_THRESHOLD_UNSPECIFIED";
47
+ BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
48
+ BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
49
+ BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
50
+ BLOCK_NONE: "BLOCK_NONE";
51
+ OFF: "OFF";
108
52
  }>>;
109
- }, "strip", z.ZodTypeAny, {
110
- responseModalities?: ("TEXT" | "IMAGE")[] | undefined;
111
- thinkingConfig?: {
112
- thinkingBudget?: number | undefined;
113
- } | undefined;
114
- cachedContent?: string | undefined;
115
- structuredOutputs?: boolean | undefined;
116
- threshold?: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF" | undefined;
117
- safetySettings?: {
118
- category: "HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
119
- threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
120
- }[] | undefined;
121
- audioTimestamp?: boolean | undefined;
122
- useSearchGrounding?: boolean | undefined;
123
- dynamicRetrievalConfig?: {
124
- mode?: "MODE_UNSPECIFIED" | "MODE_DYNAMIC" | undefined;
125
- dynamicThreshold?: number | undefined;
126
- } | undefined;
127
- }, {
128
- responseModalities?: ("TEXT" | "IMAGE")[] | undefined;
129
- thinkingConfig?: {
130
- thinkingBudget?: number | undefined;
131
- } | undefined;
132
- cachedContent?: string | undefined;
133
- structuredOutputs?: boolean | undefined;
134
- threshold?: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF" | undefined;
135
- safetySettings?: {
136
- category: "HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
137
- threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
138
- }[] | undefined;
139
- audioTimestamp?: boolean | undefined;
140
- useSearchGrounding?: boolean | undefined;
141
- dynamicRetrievalConfig?: {
142
- mode?: "MODE_UNSPECIFIED" | "MODE_DYNAMIC" | undefined;
143
- dynamicThreshold?: number | undefined;
144
- } | undefined;
145
- }>;
53
+ audioTimestamp: z.ZodOptional<z.ZodBoolean>;
54
+ }, z.core.$strip>;
146
55
  type GoogleGenerativeAIProviderOptions = z.infer<typeof googleGenerativeAIProviderOptions>;
147
56
 
148
57
  declare const groundingMetadataSchema: z.ZodObject<{
149
- webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
150
- retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
58
+ webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
59
+ retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
151
60
  searchEntryPoint: z.ZodOptional<z.ZodNullable<z.ZodObject<{
152
61
  renderedContent: z.ZodString;
153
- }, "strip", z.ZodTypeAny, {
154
- renderedContent: string;
155
- }, {
156
- renderedContent: string;
157
- }>>>;
62
+ }, z.core.$strip>>>;
158
63
  groundingChunks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
159
64
  web: z.ZodOptional<z.ZodNullable<z.ZodObject<{
160
65
  uri: z.ZodString;
161
66
  title: z.ZodString;
162
- }, "strip", z.ZodTypeAny, {
163
- uri: string;
164
- title: string;
165
- }, {
166
- uri: string;
167
- title: string;
168
- }>>>;
67
+ }, z.core.$strip>>>;
169
68
  retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
170
69
  uri: z.ZodString;
171
70
  title: z.ZodString;
172
- }, "strip", z.ZodTypeAny, {
173
- uri: string;
174
- title: string;
175
- }, {
176
- uri: string;
177
- title: string;
178
- }>>>;
179
- }, "strip", z.ZodTypeAny, {
180
- web?: {
181
- uri: string;
182
- title: string;
183
- } | null | undefined;
184
- retrievedContext?: {
185
- uri: string;
186
- title: string;
187
- } | null | undefined;
188
- }, {
189
- web?: {
190
- uri: string;
191
- title: string;
192
- } | null | undefined;
193
- retrievedContext?: {
194
- uri: string;
195
- title: string;
196
- } | null | undefined;
197
- }>, "many">>>;
71
+ }, z.core.$strip>>>;
72
+ }, z.core.$strip>>>>;
198
73
  groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
199
74
  segment: z.ZodObject<{
200
75
  startIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
201
76
  endIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
202
77
  text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
203
- }, "strip", z.ZodTypeAny, {
204
- text?: string | null | undefined;
205
- startIndex?: number | null | undefined;
206
- endIndex?: number | null | undefined;
207
- }, {
208
- text?: string | null | undefined;
209
- startIndex?: number | null | undefined;
210
- endIndex?: number | null | undefined;
211
- }>;
78
+ }, z.core.$strip>;
212
79
  segment_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
213
- groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
214
- supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
215
- confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
216
- confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
217
- }, "strip", z.ZodTypeAny, {
218
- segment: {
219
- text?: string | null | undefined;
220
- startIndex?: number | null | undefined;
221
- endIndex?: number | null | undefined;
222
- };
223
- segment_text?: string | null | undefined;
224
- groundingChunkIndices?: number[] | null | undefined;
225
- supportChunkIndices?: number[] | null | undefined;
226
- confidenceScores?: number[] | null | undefined;
227
- confidenceScore?: number[] | null | undefined;
228
- }, {
229
- segment: {
230
- text?: string | null | undefined;
231
- startIndex?: number | null | undefined;
232
- endIndex?: number | null | undefined;
233
- };
234
- segment_text?: string | null | undefined;
235
- groundingChunkIndices?: number[] | null | undefined;
236
- supportChunkIndices?: number[] | null | undefined;
237
- confidenceScores?: number[] | null | undefined;
238
- confidenceScore?: number[] | null | undefined;
239
- }>, "many">>>;
240
- retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodObject<{
80
+ groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
81
+ supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
82
+ confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
83
+ confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
84
+ }, z.core.$strip>>>>;
85
+ retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
241
86
  webDynamicRetrievalScore: z.ZodNumber;
242
- }, "strip", z.ZodTypeAny, {
243
- webDynamicRetrievalScore: number;
244
- }, {
245
- webDynamicRetrievalScore: number;
246
- }>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>>;
247
- }, "strip", z.ZodTypeAny, {
248
- webSearchQueries?: string[] | null | undefined;
249
- retrievalQueries?: string[] | null | undefined;
250
- searchEntryPoint?: {
251
- renderedContent: string;
252
- } | null | undefined;
253
- groundingChunks?: {
254
- web?: {
255
- uri: string;
256
- title: string;
257
- } | null | undefined;
258
- retrievedContext?: {
259
- uri: string;
260
- title: string;
261
- } | null | undefined;
262
- }[] | null | undefined;
263
- groundingSupports?: {
264
- segment: {
265
- text?: string | null | undefined;
266
- startIndex?: number | null | undefined;
267
- endIndex?: number | null | undefined;
268
- };
269
- segment_text?: string | null | undefined;
270
- groundingChunkIndices?: number[] | null | undefined;
271
- supportChunkIndices?: number[] | null | undefined;
272
- confidenceScores?: number[] | null | undefined;
273
- confidenceScore?: number[] | null | undefined;
274
- }[] | null | undefined;
275
- retrievalMetadata?: {
276
- webDynamicRetrievalScore: number;
277
- } | {} | null | undefined;
278
- }, {
279
- webSearchQueries?: string[] | null | undefined;
280
- retrievalQueries?: string[] | null | undefined;
281
- searchEntryPoint?: {
282
- renderedContent: string;
283
- } | null | undefined;
284
- groundingChunks?: {
285
- web?: {
286
- uri: string;
287
- title: string;
288
- } | null | undefined;
289
- retrievedContext?: {
290
- uri: string;
291
- title: string;
292
- } | null | undefined;
293
- }[] | null | undefined;
294
- groundingSupports?: {
295
- segment: {
296
- text?: string | null | undefined;
297
- startIndex?: number | null | undefined;
298
- endIndex?: number | null | undefined;
299
- };
300
- segment_text?: string | null | undefined;
301
- groundingChunkIndices?: number[] | null | undefined;
302
- supportChunkIndices?: number[] | null | undefined;
303
- confidenceScores?: number[] | null | undefined;
304
- confidenceScore?: number[] | null | undefined;
305
- }[] | null | undefined;
306
- retrievalMetadata?: {
307
- webDynamicRetrievalScore: number;
308
- } | {} | null | undefined;
309
- }>;
87
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>>;
88
+ }, z.core.$strip>;
89
+
90
+ declare const urlContextMetadataSchema: z.ZodObject<{
91
+ urlMetadata: z.ZodArray<z.ZodObject<{
92
+ retrievedUrl: z.ZodString;
93
+ urlRetrievalStatus: z.ZodString;
94
+ }, z.core.$strip>>;
95
+ }, z.core.$strip>;
96
+
310
97
  declare const safetyRatingSchema: z.ZodObject<{
311
98
  category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
312
99
  probability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -314,36 +101,68 @@ declare const safetyRatingSchema: z.ZodObject<{
314
101
  severity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
315
102
  severityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
316
103
  blocked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
317
- }, "strip", z.ZodTypeAny, {
318
- category?: string | null | undefined;
319
- probability?: string | null | undefined;
320
- probabilityScore?: number | null | undefined;
321
- severity?: string | null | undefined;
322
- severityScore?: number | null | undefined;
323
- blocked?: boolean | null | undefined;
324
- }, {
325
- category?: string | null | undefined;
326
- probability?: string | null | undefined;
327
- probabilityScore?: number | null | undefined;
328
- severity?: string | null | undefined;
329
- severityScore?: number | null | undefined;
330
- blocked?: boolean | null | undefined;
331
- }>;
104
+ }, z.core.$strip>;
332
105
 
333
106
  type GoogleGenerativeAIGroundingMetadata = z.infer<typeof groundingMetadataSchema>;
107
+ type GoogleGenerativeAIUrlContextMetadata = z.infer<typeof urlContextMetadataSchema>;
334
108
  type GoogleGenerativeAISafetyRating = z.infer<typeof safetyRatingSchema>;
335
109
  interface GoogleGenerativeAIProviderMetadata {
336
110
  groundingMetadata: GoogleGenerativeAIGroundingMetadata | null;
111
+ urlContextMetadata: GoogleGenerativeAIUrlContextMetadata | null;
337
112
  safetyRatings: GoogleGenerativeAISafetyRating[] | null;
338
113
  }
339
114
 
115
+ type GoogleGenerativeAIImageModelId = 'imagen-3.0-generate-002' | (string & {});
116
+ interface GoogleGenerativeAIImageSettings {
117
+ /**
118
+ Override the maximum number of images per call (default 4)
119
+ */
120
+ maxImagesPerCall?: number;
121
+ }
122
+
123
+ declare const googleImageProviderOptionsSchema: z.ZodObject<{
124
+ personGeneration: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
125
+ dont_allow: "dont_allow";
126
+ allow_adult: "allow_adult";
127
+ allow_all: "allow_all";
128
+ }>>>;
129
+ aspectRatio: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
130
+ "1:1": "1:1";
131
+ "3:4": "3:4";
132
+ "4:3": "4:3";
133
+ "9:16": "9:16";
134
+ "16:9": "16:9";
135
+ }>>>;
136
+ }, z.core.$strip>;
137
+ type GoogleGenerativeAIImageProviderOptions = z.infer<typeof googleImageProviderOptionsSchema>;
138
+
340
139
  type GoogleGenerativeAIEmbeddingModelId = 'text-embedding-004' | (string & {});
341
140
 
141
+ declare const googleTools: {
142
+ /**
143
+ * Creates a Google search tool that gives Google direct access to real-time web content.
144
+ * Must have name "google_search".
145
+ */
146
+ googleSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
147
+ mode?: "MODE_DYNAMIC" | "MODE_UNSPECIFIED";
148
+ dynamicThreshold?: number;
149
+ }>;
150
+ /**
151
+ * Creates a URL context tool that gives Google direct access to real-time web content.
152
+ * Must have name "url_context".
153
+ */
154
+ urlContext: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {}>;
155
+ };
156
+
342
157
  interface GoogleGenerativeAIProvider extends ProviderV2 {
343
158
  (modelId: GoogleGenerativeAIModelId): LanguageModelV2;
344
159
  languageModel(modelId: GoogleGenerativeAIModelId): LanguageModelV2;
345
160
  chat(modelId: GoogleGenerativeAIModelId): LanguageModelV2;
346
161
  /**
162
+ Creates a model for image generation.
163
+ */
164
+ image(modelId: GoogleGenerativeAIImageModelId, settings?: GoogleGenerativeAIImageSettings): ImageModelV2;
165
+ /**
347
166
  * @deprecated Use `chat()` instead.
348
167
  */
349
168
  generativeAI(modelId: GoogleGenerativeAIModelId): LanguageModelV2;
@@ -356,6 +175,7 @@ interface GoogleGenerativeAIProvider extends ProviderV2 {
356
175
  */
357
176
  textEmbedding(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV2<string>;
358
177
  textEmbeddingModel(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV2<string>;
178
+ tools: typeof googleTools;
359
179
  }
360
180
  interface GoogleGenerativeAIProviderSettings {
361
181
  /**
@@ -391,4 +211,4 @@ Default Google Generative AI provider instance.
391
211
  */
392
212
  declare const google: GoogleGenerativeAIProvider;
393
213
 
394
- export { type GoogleErrorData, type GoogleGenerativeAIProvider, type GoogleGenerativeAIProviderMetadata, type GoogleGenerativeAIProviderOptions, type GoogleGenerativeAIProviderSettings, createGoogleGenerativeAI, google };
214
+ export { type GoogleErrorData, type GoogleGenerativeAIImageProviderOptions, type GoogleGenerativeAIProvider, type GoogleGenerativeAIProviderMetadata, type GoogleGenerativeAIProviderOptions, type GoogleGenerativeAIProviderSettings, createGoogleGenerativeAI, google };