@ai-sdk/google 2.0.0-beta.1 → 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 +65 -0
- package/dist/index.d.mts +109 -294
- package/dist/index.d.ts +109 -294
- package/dist/index.js +379 -185
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +352 -153
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +22 -180
- package/dist/internal/index.d.ts +22 -180
- package/dist/internal/index.js +259 -172
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +232 -144
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,70 @@
|
|
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
|
+
|
3
68
|
## 2.0.0-beta.1
|
4
69
|
|
5
70
|
### 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,311 +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
|
-
},
|
11
|
-
|
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-
|
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<
|
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
23
|
includeThoughts: z.ZodOptional<z.ZodBoolean>;
|
40
|
-
},
|
41
|
-
thinkingBudget?: number | undefined;
|
42
|
-
includeThoughts?: boolean | undefined;
|
43
|
-
}, {
|
44
|
-
thinkingBudget?: number | undefined;
|
45
|
-
includeThoughts?: boolean | undefined;
|
46
|
-
}>>;
|
47
|
-
/**
|
48
|
-
Optional.
|
49
|
-
The name of the cached content used as context to serve the prediction.
|
50
|
-
Format: cachedContents/{cachedContent}
|
51
|
-
*/
|
24
|
+
}, z.core.$strip>>;
|
52
25
|
cachedContent: z.ZodOptional<z.ZodString>;
|
53
|
-
/**
|
54
|
-
* Optional. Enable structured output. Default is true.
|
55
|
-
*
|
56
|
-
* This is useful when the JSON Schema contains elements that are
|
57
|
-
* not supported by the OpenAPI schema version that
|
58
|
-
* Google Generative AI uses. You can use this to disable
|
59
|
-
* structured outputs if you need to.
|
60
|
-
*/
|
61
26
|
structuredOutputs: z.ZodOptional<z.ZodBoolean>;
|
62
|
-
/**
|
63
|
-
Optional. A list of unique safety settings for blocking unsafe content.
|
64
|
-
*/
|
65
27
|
safetySettings: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
66
|
-
category: z.ZodEnum<
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
@note Dynamic retrieval is only compatible with Gemini 1.5 Flash.
|
92
|
-
|
93
|
-
@see https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/ground-with-google-search#dynamic-retrieval
|
94
|
-
*/
|
95
|
-
dynamicRetrievalConfig: z.ZodOptional<z.ZodObject<{
|
96
|
-
/**
|
97
|
-
* The mode of the predictor to be used in dynamic retrieval.
|
98
|
-
*/
|
99
|
-
mode: z.ZodOptional<z.ZodEnum<["MODE_UNSPECIFIED", "MODE_DYNAMIC"]>>;
|
100
|
-
/**
|
101
|
-
* The threshold to be used in dynamic retrieval. If not set, a system default
|
102
|
-
* value is used.
|
103
|
-
*/
|
104
|
-
dynamicThreshold: z.ZodOptional<z.ZodNumber>;
|
105
|
-
}, "strip", z.ZodTypeAny, {
|
106
|
-
mode?: "MODE_UNSPECIFIED" | "MODE_DYNAMIC" | undefined;
|
107
|
-
dynamicThreshold?: number | undefined;
|
108
|
-
}, {
|
109
|
-
mode?: "MODE_UNSPECIFIED" | "MODE_DYNAMIC" | undefined;
|
110
|
-
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";
|
111
52
|
}>>;
|
112
|
-
|
113
|
-
|
114
|
-
thinkingConfig?: {
|
115
|
-
thinkingBudget?: number | undefined;
|
116
|
-
includeThoughts?: boolean | undefined;
|
117
|
-
} | undefined;
|
118
|
-
cachedContent?: string | undefined;
|
119
|
-
structuredOutputs?: boolean | undefined;
|
120
|
-
threshold?: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF" | undefined;
|
121
|
-
safetySettings?: {
|
122
|
-
category: "HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
|
123
|
-
threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
|
124
|
-
}[] | undefined;
|
125
|
-
audioTimestamp?: boolean | undefined;
|
126
|
-
useSearchGrounding?: boolean | undefined;
|
127
|
-
dynamicRetrievalConfig?: {
|
128
|
-
mode?: "MODE_UNSPECIFIED" | "MODE_DYNAMIC" | undefined;
|
129
|
-
dynamicThreshold?: number | undefined;
|
130
|
-
} | undefined;
|
131
|
-
}, {
|
132
|
-
responseModalities?: ("TEXT" | "IMAGE")[] | undefined;
|
133
|
-
thinkingConfig?: {
|
134
|
-
thinkingBudget?: number | undefined;
|
135
|
-
includeThoughts?: boolean | undefined;
|
136
|
-
} | undefined;
|
137
|
-
cachedContent?: string | undefined;
|
138
|
-
structuredOutputs?: boolean | undefined;
|
139
|
-
threshold?: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF" | undefined;
|
140
|
-
safetySettings?: {
|
141
|
-
category: "HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
|
142
|
-
threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
|
143
|
-
}[] | undefined;
|
144
|
-
audioTimestamp?: boolean | undefined;
|
145
|
-
useSearchGrounding?: boolean | undefined;
|
146
|
-
dynamicRetrievalConfig?: {
|
147
|
-
mode?: "MODE_UNSPECIFIED" | "MODE_DYNAMIC" | undefined;
|
148
|
-
dynamicThreshold?: number | undefined;
|
149
|
-
} | undefined;
|
150
|
-
}>;
|
53
|
+
audioTimestamp: z.ZodOptional<z.ZodBoolean>;
|
54
|
+
}, z.core.$strip>;
|
151
55
|
type GoogleGenerativeAIProviderOptions = z.infer<typeof googleGenerativeAIProviderOptions>;
|
152
56
|
|
153
57
|
declare const groundingMetadataSchema: z.ZodObject<{
|
154
|
-
webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString
|
155
|
-
retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString
|
58
|
+
webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
59
|
+
retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
156
60
|
searchEntryPoint: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
157
61
|
renderedContent: z.ZodString;
|
158
|
-
},
|
159
|
-
renderedContent: string;
|
160
|
-
}, {
|
161
|
-
renderedContent: string;
|
162
|
-
}>>>;
|
62
|
+
}, z.core.$strip>>>;
|
163
63
|
groundingChunks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
164
64
|
web: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
165
65
|
uri: z.ZodString;
|
166
66
|
title: z.ZodString;
|
167
|
-
},
|
168
|
-
uri: string;
|
169
|
-
title: string;
|
170
|
-
}, {
|
171
|
-
uri: string;
|
172
|
-
title: string;
|
173
|
-
}>>>;
|
67
|
+
}, z.core.$strip>>>;
|
174
68
|
retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
175
69
|
uri: z.ZodString;
|
176
70
|
title: z.ZodString;
|
177
|
-
},
|
178
|
-
|
179
|
-
title: string;
|
180
|
-
}, {
|
181
|
-
uri: string;
|
182
|
-
title: string;
|
183
|
-
}>>>;
|
184
|
-
}, "strip", z.ZodTypeAny, {
|
185
|
-
web?: {
|
186
|
-
uri: string;
|
187
|
-
title: string;
|
188
|
-
} | null | undefined;
|
189
|
-
retrievedContext?: {
|
190
|
-
uri: string;
|
191
|
-
title: string;
|
192
|
-
} | null | undefined;
|
193
|
-
}, {
|
194
|
-
web?: {
|
195
|
-
uri: string;
|
196
|
-
title: string;
|
197
|
-
} | null | undefined;
|
198
|
-
retrievedContext?: {
|
199
|
-
uri: string;
|
200
|
-
title: string;
|
201
|
-
} | null | undefined;
|
202
|
-
}>, "many">>>;
|
71
|
+
}, z.core.$strip>>>;
|
72
|
+
}, z.core.$strip>>>>;
|
203
73
|
groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
204
74
|
segment: z.ZodObject<{
|
205
75
|
startIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
206
76
|
endIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
207
77
|
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
208
|
-
},
|
209
|
-
text?: string | null | undefined;
|
210
|
-
startIndex?: number | null | undefined;
|
211
|
-
endIndex?: number | null | undefined;
|
212
|
-
}, {
|
213
|
-
text?: string | null | undefined;
|
214
|
-
startIndex?: number | null | undefined;
|
215
|
-
endIndex?: number | null | undefined;
|
216
|
-
}>;
|
78
|
+
}, z.core.$strip>;
|
217
79
|
segment_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
218
|
-
groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber
|
219
|
-
supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber
|
220
|
-
confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber
|
221
|
-
confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber
|
222
|
-
},
|
223
|
-
|
224
|
-
text?: string | null | undefined;
|
225
|
-
startIndex?: number | null | undefined;
|
226
|
-
endIndex?: number | null | undefined;
|
227
|
-
};
|
228
|
-
segment_text?: string | null | undefined;
|
229
|
-
groundingChunkIndices?: number[] | null | undefined;
|
230
|
-
supportChunkIndices?: number[] | null | undefined;
|
231
|
-
confidenceScores?: number[] | null | undefined;
|
232
|
-
confidenceScore?: number[] | null | undefined;
|
233
|
-
}, {
|
234
|
-
segment: {
|
235
|
-
text?: string | null | undefined;
|
236
|
-
startIndex?: number | null | undefined;
|
237
|
-
endIndex?: number | 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
|
-
}>, "many">>>;
|
245
|
-
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<{
|
246
86
|
webDynamicRetrievalScore: z.ZodNumber;
|
247
|
-
},
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
} | null | undefined;
|
258
|
-
groundingChunks?: {
|
259
|
-
web?: {
|
260
|
-
uri: string;
|
261
|
-
title: string;
|
262
|
-
} | null | undefined;
|
263
|
-
retrievedContext?: {
|
264
|
-
uri: string;
|
265
|
-
title: string;
|
266
|
-
} | null | undefined;
|
267
|
-
}[] | null | undefined;
|
268
|
-
groundingSupports?: {
|
269
|
-
segment: {
|
270
|
-
text?: string | null | undefined;
|
271
|
-
startIndex?: number | null | undefined;
|
272
|
-
endIndex?: number | null | undefined;
|
273
|
-
};
|
274
|
-
segment_text?: string | null | undefined;
|
275
|
-
groundingChunkIndices?: number[] | null | undefined;
|
276
|
-
supportChunkIndices?: number[] | null | undefined;
|
277
|
-
confidenceScores?: number[] | null | undefined;
|
278
|
-
confidenceScore?: number[] | null | undefined;
|
279
|
-
}[] | null | undefined;
|
280
|
-
retrievalMetadata?: {
|
281
|
-
webDynamicRetrievalScore: number;
|
282
|
-
} | {} | null | undefined;
|
283
|
-
}, {
|
284
|
-
webSearchQueries?: string[] | null | undefined;
|
285
|
-
retrievalQueries?: string[] | null | undefined;
|
286
|
-
searchEntryPoint?: {
|
287
|
-
renderedContent: string;
|
288
|
-
} | null | undefined;
|
289
|
-
groundingChunks?: {
|
290
|
-
web?: {
|
291
|
-
uri: string;
|
292
|
-
title: string;
|
293
|
-
} | null | undefined;
|
294
|
-
retrievedContext?: {
|
295
|
-
uri: string;
|
296
|
-
title: string;
|
297
|
-
} | null | undefined;
|
298
|
-
}[] | null | undefined;
|
299
|
-
groundingSupports?: {
|
300
|
-
segment: {
|
301
|
-
text?: string | null | undefined;
|
302
|
-
startIndex?: number | null | undefined;
|
303
|
-
endIndex?: number | null | undefined;
|
304
|
-
};
|
305
|
-
segment_text?: string | null | undefined;
|
306
|
-
groundingChunkIndices?: number[] | null | undefined;
|
307
|
-
supportChunkIndices?: number[] | null | undefined;
|
308
|
-
confidenceScores?: number[] | null | undefined;
|
309
|
-
confidenceScore?: number[] | null | undefined;
|
310
|
-
}[] | null | undefined;
|
311
|
-
retrievalMetadata?: {
|
312
|
-
webDynamicRetrievalScore: number;
|
313
|
-
} | {} | null | undefined;
|
314
|
-
}>;
|
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
|
+
|
315
97
|
declare const safetyRatingSchema: z.ZodObject<{
|
316
98
|
category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
317
99
|
probability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
@@ -319,36 +101,68 @@ declare const safetyRatingSchema: z.ZodObject<{
|
|
319
101
|
severity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
320
102
|
severityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
321
103
|
blocked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
322
|
-
},
|
323
|
-
category?: string | null | undefined;
|
324
|
-
probability?: string | null | undefined;
|
325
|
-
probabilityScore?: number | null | undefined;
|
326
|
-
severity?: string | null | undefined;
|
327
|
-
severityScore?: number | null | undefined;
|
328
|
-
blocked?: boolean | null | undefined;
|
329
|
-
}, {
|
330
|
-
category?: string | null | undefined;
|
331
|
-
probability?: string | null | undefined;
|
332
|
-
probabilityScore?: number | null | undefined;
|
333
|
-
severity?: string | null | undefined;
|
334
|
-
severityScore?: number | null | undefined;
|
335
|
-
blocked?: boolean | null | undefined;
|
336
|
-
}>;
|
104
|
+
}, z.core.$strip>;
|
337
105
|
|
338
106
|
type GoogleGenerativeAIGroundingMetadata = z.infer<typeof groundingMetadataSchema>;
|
107
|
+
type GoogleGenerativeAIUrlContextMetadata = z.infer<typeof urlContextMetadataSchema>;
|
339
108
|
type GoogleGenerativeAISafetyRating = z.infer<typeof safetyRatingSchema>;
|
340
109
|
interface GoogleGenerativeAIProviderMetadata {
|
341
110
|
groundingMetadata: GoogleGenerativeAIGroundingMetadata | null;
|
111
|
+
urlContextMetadata: GoogleGenerativeAIUrlContextMetadata | null;
|
342
112
|
safetyRatings: GoogleGenerativeAISafetyRating[] | null;
|
343
113
|
}
|
344
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
|
+
|
345
139
|
type GoogleGenerativeAIEmbeddingModelId = 'text-embedding-004' | (string & {});
|
346
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
|
+
|
347
157
|
interface GoogleGenerativeAIProvider extends ProviderV2 {
|
348
158
|
(modelId: GoogleGenerativeAIModelId): LanguageModelV2;
|
349
159
|
languageModel(modelId: GoogleGenerativeAIModelId): LanguageModelV2;
|
350
160
|
chat(modelId: GoogleGenerativeAIModelId): LanguageModelV2;
|
351
161
|
/**
|
162
|
+
Creates a model for image generation.
|
163
|
+
*/
|
164
|
+
image(modelId: GoogleGenerativeAIImageModelId, settings?: GoogleGenerativeAIImageSettings): ImageModelV2;
|
165
|
+
/**
|
352
166
|
* @deprecated Use `chat()` instead.
|
353
167
|
*/
|
354
168
|
generativeAI(modelId: GoogleGenerativeAIModelId): LanguageModelV2;
|
@@ -361,6 +175,7 @@ interface GoogleGenerativeAIProvider extends ProviderV2 {
|
|
361
175
|
*/
|
362
176
|
textEmbedding(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV2<string>;
|
363
177
|
textEmbeddingModel(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV2<string>;
|
178
|
+
tools: typeof googleTools;
|
364
179
|
}
|
365
180
|
interface GoogleGenerativeAIProviderSettings {
|
366
181
|
/**
|
@@ -396,4 +211,4 @@ Default Google Generative AI provider instance.
|
|
396
211
|
*/
|
397
212
|
declare const google: GoogleGenerativeAIProvider;
|
398
213
|
|
399
|
-
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 };
|