@ai-sdk/google 2.0.0-beta.2 → 2.0.0-beta.4
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 +18 -0
- package/dist/index.d.mts +56 -289
- package/dist/index.d.ts +56 -289
- package/dist/index.js +101 -95
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -7
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +18 -162
- package/dist/internal/index.d.ts +18 -162
- package/dist/internal/index.js +94 -88
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +11 -5
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/internal/index.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
2
2
|
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
3
|
-
import { z } from 'zod';
|
3
|
+
import { z } from 'zod/v4';
|
4
4
|
|
5
|
-
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-12b-it' | 'gemma-3-27b-it' |
|
5
|
+
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 & {});
|
6
6
|
|
7
7
|
type GoogleGenerativeAIConfig = {
|
8
8
|
provider: string;
|
@@ -27,167 +27,37 @@ declare class GoogleGenerativeAILanguageModel implements LanguageModelV2 {
|
|
27
27
|
doStream(options: Parameters<LanguageModelV2['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
|
28
28
|
}
|
29
29
|
declare const groundingMetadataSchema: z.ZodObject<{
|
30
|
-
webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString
|
31
|
-
retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString
|
30
|
+
webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
31
|
+
retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
32
32
|
searchEntryPoint: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
33
33
|
renderedContent: z.ZodString;
|
34
|
-
},
|
35
|
-
renderedContent: string;
|
36
|
-
}, {
|
37
|
-
renderedContent: string;
|
38
|
-
}>>>;
|
34
|
+
}, z.core.$strip>>>;
|
39
35
|
groundingChunks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
40
36
|
web: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
41
37
|
uri: z.ZodString;
|
42
38
|
title: z.ZodString;
|
43
|
-
},
|
44
|
-
uri: string;
|
45
|
-
title: string;
|
46
|
-
}, {
|
47
|
-
uri: string;
|
48
|
-
title: string;
|
49
|
-
}>>>;
|
39
|
+
}, z.core.$strip>>>;
|
50
40
|
retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
51
41
|
uri: z.ZodString;
|
52
42
|
title: z.ZodString;
|
53
|
-
},
|
54
|
-
|
55
|
-
title: string;
|
56
|
-
}, {
|
57
|
-
uri: string;
|
58
|
-
title: string;
|
59
|
-
}>>>;
|
60
|
-
}, "strip", z.ZodTypeAny, {
|
61
|
-
web?: {
|
62
|
-
uri: string;
|
63
|
-
title: string;
|
64
|
-
} | null | undefined;
|
65
|
-
retrievedContext?: {
|
66
|
-
uri: string;
|
67
|
-
title: string;
|
68
|
-
} | null | undefined;
|
69
|
-
}, {
|
70
|
-
web?: {
|
71
|
-
uri: string;
|
72
|
-
title: string;
|
73
|
-
} | null | undefined;
|
74
|
-
retrievedContext?: {
|
75
|
-
uri: string;
|
76
|
-
title: string;
|
77
|
-
} | null | undefined;
|
78
|
-
}>, "many">>>;
|
43
|
+
}, z.core.$strip>>>;
|
44
|
+
}, z.core.$strip>>>>;
|
79
45
|
groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
80
46
|
segment: z.ZodObject<{
|
81
47
|
startIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
82
48
|
endIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
83
49
|
text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
84
|
-
},
|
85
|
-
startIndex?: number | null | undefined;
|
86
|
-
endIndex?: number | null | undefined;
|
87
|
-
text?: string | null | undefined;
|
88
|
-
}, {
|
89
|
-
startIndex?: number | null | undefined;
|
90
|
-
endIndex?: number | null | undefined;
|
91
|
-
text?: string | null | undefined;
|
92
|
-
}>;
|
50
|
+
}, z.core.$strip>;
|
93
51
|
segment_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
94
|
-
groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber
|
95
|
-
supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber
|
96
|
-
confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber
|
97
|
-
confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber
|
98
|
-
},
|
99
|
-
|
100
|
-
startIndex?: number | null | undefined;
|
101
|
-
endIndex?: number | null | undefined;
|
102
|
-
text?: string | null | undefined;
|
103
|
-
};
|
104
|
-
segment_text?: string | null | undefined;
|
105
|
-
groundingChunkIndices?: number[] | null | undefined;
|
106
|
-
supportChunkIndices?: number[] | null | undefined;
|
107
|
-
confidenceScores?: number[] | null | undefined;
|
108
|
-
confidenceScore?: number[] | null | undefined;
|
109
|
-
}, {
|
110
|
-
segment: {
|
111
|
-
startIndex?: number | null | undefined;
|
112
|
-
endIndex?: number | null | undefined;
|
113
|
-
text?: string | null | undefined;
|
114
|
-
};
|
115
|
-
segment_text?: string | null | undefined;
|
116
|
-
groundingChunkIndices?: number[] | null | undefined;
|
117
|
-
supportChunkIndices?: number[] | null | undefined;
|
118
|
-
confidenceScores?: number[] | null | undefined;
|
119
|
-
confidenceScore?: number[] | null | undefined;
|
120
|
-
}>, "many">>>;
|
121
|
-
retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodObject<{
|
52
|
+
groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
|
53
|
+
supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
|
54
|
+
confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
|
55
|
+
confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
|
56
|
+
}, z.core.$strip>>>>;
|
57
|
+
retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
|
122
58
|
webDynamicRetrievalScore: z.ZodNumber;
|
123
|
-
},
|
124
|
-
|
125
|
-
}, {
|
126
|
-
webDynamicRetrievalScore: number;
|
127
|
-
}>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>>;
|
128
|
-
}, "strip", z.ZodTypeAny, {
|
129
|
-
webSearchQueries?: string[] | null | undefined;
|
130
|
-
retrievalQueries?: string[] | null | undefined;
|
131
|
-
searchEntryPoint?: {
|
132
|
-
renderedContent: string;
|
133
|
-
} | null | undefined;
|
134
|
-
groundingChunks?: {
|
135
|
-
web?: {
|
136
|
-
uri: string;
|
137
|
-
title: string;
|
138
|
-
} | null | undefined;
|
139
|
-
retrievedContext?: {
|
140
|
-
uri: string;
|
141
|
-
title: string;
|
142
|
-
} | null | undefined;
|
143
|
-
}[] | null | undefined;
|
144
|
-
groundingSupports?: {
|
145
|
-
segment: {
|
146
|
-
startIndex?: number | null | undefined;
|
147
|
-
endIndex?: number | null | undefined;
|
148
|
-
text?: string | null | undefined;
|
149
|
-
};
|
150
|
-
segment_text?: string | null | undefined;
|
151
|
-
groundingChunkIndices?: number[] | null | undefined;
|
152
|
-
supportChunkIndices?: number[] | null | undefined;
|
153
|
-
confidenceScores?: number[] | null | undefined;
|
154
|
-
confidenceScore?: number[] | null | undefined;
|
155
|
-
}[] | null | undefined;
|
156
|
-
retrievalMetadata?: {
|
157
|
-
webDynamicRetrievalScore: number;
|
158
|
-
} | {} | null | undefined;
|
159
|
-
}, {
|
160
|
-
webSearchQueries?: string[] | null | undefined;
|
161
|
-
retrievalQueries?: string[] | null | undefined;
|
162
|
-
searchEntryPoint?: {
|
163
|
-
renderedContent: string;
|
164
|
-
} | null | undefined;
|
165
|
-
groundingChunks?: {
|
166
|
-
web?: {
|
167
|
-
uri: string;
|
168
|
-
title: string;
|
169
|
-
} | null | undefined;
|
170
|
-
retrievedContext?: {
|
171
|
-
uri: string;
|
172
|
-
title: string;
|
173
|
-
} | null | undefined;
|
174
|
-
}[] | null | undefined;
|
175
|
-
groundingSupports?: {
|
176
|
-
segment: {
|
177
|
-
startIndex?: number | null | undefined;
|
178
|
-
endIndex?: number | null | undefined;
|
179
|
-
text?: string | null | undefined;
|
180
|
-
};
|
181
|
-
segment_text?: string | null | undefined;
|
182
|
-
groundingChunkIndices?: number[] | null | undefined;
|
183
|
-
supportChunkIndices?: number[] | null | undefined;
|
184
|
-
confidenceScores?: number[] | null | undefined;
|
185
|
-
confidenceScore?: number[] | null | undefined;
|
186
|
-
}[] | null | undefined;
|
187
|
-
retrievalMetadata?: {
|
188
|
-
webDynamicRetrievalScore: number;
|
189
|
-
} | {} | null | undefined;
|
190
|
-
}>;
|
59
|
+
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>>;
|
60
|
+
}, z.core.$strip>;
|
191
61
|
declare const safetyRatingSchema: z.ZodObject<{
|
192
62
|
category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
193
63
|
probability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
@@ -195,20 +65,6 @@ declare const safetyRatingSchema: z.ZodObject<{
|
|
195
65
|
severity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
196
66
|
severityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
197
67
|
blocked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
198
|
-
},
|
199
|
-
category?: string | null | undefined;
|
200
|
-
probability?: string | null | undefined;
|
201
|
-
probabilityScore?: number | null | undefined;
|
202
|
-
severity?: string | null | undefined;
|
203
|
-
severityScore?: number | null | undefined;
|
204
|
-
blocked?: boolean | null | undefined;
|
205
|
-
}, {
|
206
|
-
category?: string | null | undefined;
|
207
|
-
probability?: string | null | undefined;
|
208
|
-
probabilityScore?: number | null | undefined;
|
209
|
-
severity?: string | null | undefined;
|
210
|
-
severityScore?: number | null | undefined;
|
211
|
-
blocked?: boolean | null | undefined;
|
212
|
-
}>;
|
68
|
+
}, z.core.$strip>;
|
213
69
|
|
214
70
|
export { GoogleGenerativeAILanguageModel, groundingMetadataSchema, safetyRatingSchema };
|
package/dist/internal/index.js
CHANGED
@@ -28,7 +28,7 @@ module.exports = __toCommonJS(internal_exports);
|
|
28
28
|
|
29
29
|
// src/google-generative-ai-language-model.ts
|
30
30
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
31
|
-
var
|
31
|
+
var import_v43 = require("zod/v4");
|
32
32
|
|
33
33
|
// src/convert-json-schema-to-openapi-schema.ts
|
34
34
|
function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
@@ -50,7 +50,8 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
50
50
|
format,
|
51
51
|
const: constValue,
|
52
52
|
minLength,
|
53
|
-
enum: enumValues
|
53
|
+
enum: enumValues,
|
54
|
+
additionalProperties
|
54
55
|
} = jsonSchema;
|
55
56
|
const result = {};
|
56
57
|
if (description)
|
@@ -121,10 +122,15 @@ function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
|
121
122
|
if (minLength !== void 0) {
|
122
123
|
result.minLength = minLength;
|
123
124
|
}
|
125
|
+
if (additionalProperties === true) {
|
126
|
+
result.additionalProperties = true;
|
127
|
+
} else if (additionalProperties) {
|
128
|
+
result.additionalProperties = convertJSONSchemaToOpenAPISchema(additionalProperties);
|
129
|
+
}
|
124
130
|
return result;
|
125
131
|
}
|
126
132
|
function isEmptyObjectSchema(jsonSchema) {
|
127
|
-
return jsonSchema != null && typeof jsonSchema === "object" && jsonSchema.type === "object" && (jsonSchema.properties == null || Object.keys(jsonSchema.properties).length === 0);
|
133
|
+
return jsonSchema != null && typeof jsonSchema === "object" && jsonSchema.type === "object" && (jsonSchema.properties == null || Object.keys(jsonSchema.properties).length === 0) && !jsonSchema.additionalProperties;
|
128
134
|
}
|
129
135
|
|
130
136
|
// src/convert-to-google-generative-ai-messages.ts
|
@@ -247,12 +253,12 @@ function getModelPath(modelId) {
|
|
247
253
|
|
248
254
|
// src/google-error.ts
|
249
255
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
250
|
-
var
|
251
|
-
var googleErrorDataSchema =
|
252
|
-
error:
|
253
|
-
code:
|
254
|
-
message:
|
255
|
-
status:
|
256
|
+
var import_v4 = require("zod/v4");
|
257
|
+
var googleErrorDataSchema = import_v4.z.object({
|
258
|
+
error: import_v4.z.object({
|
259
|
+
code: import_v4.z.number().nullable(),
|
260
|
+
message: import_v4.z.string(),
|
261
|
+
status: import_v4.z.string()
|
256
262
|
})
|
257
263
|
});
|
258
264
|
var googleFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResponseHandler)({
|
@@ -261,30 +267,30 @@ var googleFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResp
|
|
261
267
|
});
|
262
268
|
|
263
269
|
// src/google-generative-ai-options.ts
|
264
|
-
var
|
265
|
-
var dynamicRetrievalConfig =
|
270
|
+
var import_v42 = require("zod/v4");
|
271
|
+
var dynamicRetrievalConfig = import_v42.z.object({
|
266
272
|
/**
|
267
273
|
* The mode of the predictor to be used in dynamic retrieval.
|
268
274
|
*/
|
269
|
-
mode:
|
275
|
+
mode: import_v42.z.enum(["MODE_UNSPECIFIED", "MODE_DYNAMIC"]).optional(),
|
270
276
|
/**
|
271
277
|
* The threshold to be used in dynamic retrieval. If not set, a system default
|
272
278
|
* value is used.
|
273
279
|
*/
|
274
|
-
dynamicThreshold:
|
280
|
+
dynamicThreshold: import_v42.z.number().optional()
|
275
281
|
});
|
276
|
-
var googleGenerativeAIProviderOptions =
|
277
|
-
responseModalities:
|
278
|
-
thinkingConfig:
|
279
|
-
thinkingBudget:
|
280
|
-
includeThoughts:
|
282
|
+
var googleGenerativeAIProviderOptions = import_v42.z.object({
|
283
|
+
responseModalities: import_v42.z.array(import_v42.z.enum(["TEXT", "IMAGE"])).optional(),
|
284
|
+
thinkingConfig: import_v42.z.object({
|
285
|
+
thinkingBudget: import_v42.z.number().optional(),
|
286
|
+
includeThoughts: import_v42.z.boolean().optional()
|
281
287
|
}).optional(),
|
282
288
|
/**
|
283
289
|
Optional.
|
284
290
|
The name of the cached content used as context to serve the prediction.
|
285
291
|
Format: cachedContents/{cachedContent}
|
286
292
|
*/
|
287
|
-
cachedContent:
|
293
|
+
cachedContent: import_v42.z.string().optional(),
|
288
294
|
/**
|
289
295
|
* Optional. Enable structured output. Default is true.
|
290
296
|
*
|
@@ -293,13 +299,13 @@ var googleGenerativeAIProviderOptions = import_zod2.z.object({
|
|
293
299
|
* Google Generative AI uses. You can use this to disable
|
294
300
|
* structured outputs if you need to.
|
295
301
|
*/
|
296
|
-
structuredOutputs:
|
302
|
+
structuredOutputs: import_v42.z.boolean().optional(),
|
297
303
|
/**
|
298
304
|
Optional. A list of unique safety settings for blocking unsafe content.
|
299
305
|
*/
|
300
|
-
safetySettings:
|
301
|
-
|
302
|
-
category:
|
306
|
+
safetySettings: import_v42.z.array(
|
307
|
+
import_v42.z.object({
|
308
|
+
category: import_v42.z.enum([
|
303
309
|
"HARM_CATEGORY_UNSPECIFIED",
|
304
310
|
"HARM_CATEGORY_HATE_SPEECH",
|
305
311
|
"HARM_CATEGORY_DANGEROUS_CONTENT",
|
@@ -307,7 +313,7 @@ var googleGenerativeAIProviderOptions = import_zod2.z.object({
|
|
307
313
|
"HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
308
314
|
"HARM_CATEGORY_CIVIC_INTEGRITY"
|
309
315
|
]),
|
310
|
-
threshold:
|
316
|
+
threshold: import_v42.z.enum([
|
311
317
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
312
318
|
"BLOCK_LOW_AND_ABOVE",
|
313
319
|
"BLOCK_MEDIUM_AND_ABOVE",
|
@@ -317,7 +323,7 @@ var googleGenerativeAIProviderOptions = import_zod2.z.object({
|
|
317
323
|
])
|
318
324
|
})
|
319
325
|
).optional(),
|
320
|
-
threshold:
|
326
|
+
threshold: import_v42.z.enum([
|
321
327
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
322
328
|
"BLOCK_LOW_AND_ABOVE",
|
323
329
|
"BLOCK_MEDIUM_AND_ABOVE",
|
@@ -330,13 +336,13 @@ var googleGenerativeAIProviderOptions = import_zod2.z.object({
|
|
330
336
|
*
|
331
337
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
|
332
338
|
*/
|
333
|
-
audioTimestamp:
|
339
|
+
audioTimestamp: import_v42.z.boolean().optional(),
|
334
340
|
/**
|
335
341
|
Optional. When enabled, the model will use Google search to ground the response.
|
336
342
|
|
337
343
|
@see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/overview
|
338
344
|
*/
|
339
|
-
useSearchGrounding:
|
345
|
+
useSearchGrounding: import_v42.z.boolean().optional(),
|
340
346
|
/**
|
341
347
|
Optional. Specifies the dynamic retrieval configuration.
|
342
348
|
|
@@ -866,91 +872,91 @@ function extractSources({
|
|
866
872
|
title: chunk.web.title
|
867
873
|
}));
|
868
874
|
}
|
869
|
-
var contentSchema =
|
870
|
-
parts:
|
871
|
-
|
875
|
+
var contentSchema = import_v43.z.object({
|
876
|
+
parts: import_v43.z.array(
|
877
|
+
import_v43.z.union([
|
872
878
|
// note: order matters since text can be fully empty
|
873
|
-
|
874
|
-
functionCall:
|
875
|
-
name:
|
876
|
-
args:
|
879
|
+
import_v43.z.object({
|
880
|
+
functionCall: import_v43.z.object({
|
881
|
+
name: import_v43.z.string(),
|
882
|
+
args: import_v43.z.unknown()
|
877
883
|
})
|
878
884
|
}),
|
879
|
-
|
880
|
-
inlineData:
|
881
|
-
mimeType:
|
882
|
-
data:
|
885
|
+
import_v43.z.object({
|
886
|
+
inlineData: import_v43.z.object({
|
887
|
+
mimeType: import_v43.z.string(),
|
888
|
+
data: import_v43.z.string()
|
883
889
|
})
|
884
890
|
}),
|
885
|
-
|
886
|
-
text:
|
887
|
-
thought:
|
891
|
+
import_v43.z.object({
|
892
|
+
text: import_v43.z.string().nullish(),
|
893
|
+
thought: import_v43.z.boolean().nullish()
|
888
894
|
})
|
889
895
|
])
|
890
896
|
).nullish()
|
891
897
|
});
|
892
|
-
var groundingChunkSchema =
|
893
|
-
web:
|
894
|
-
retrievedContext:
|
898
|
+
var groundingChunkSchema = import_v43.z.object({
|
899
|
+
web: import_v43.z.object({ uri: import_v43.z.string(), title: import_v43.z.string() }).nullish(),
|
900
|
+
retrievedContext: import_v43.z.object({ uri: import_v43.z.string(), title: import_v43.z.string() }).nullish()
|
895
901
|
});
|
896
|
-
var groundingMetadataSchema =
|
897
|
-
webSearchQueries:
|
898
|
-
retrievalQueries:
|
899
|
-
searchEntryPoint:
|
900
|
-
groundingChunks:
|
901
|
-
groundingSupports:
|
902
|
-
|
903
|
-
segment:
|
904
|
-
startIndex:
|
905
|
-
endIndex:
|
906
|
-
text:
|
902
|
+
var groundingMetadataSchema = import_v43.z.object({
|
903
|
+
webSearchQueries: import_v43.z.array(import_v43.z.string()).nullish(),
|
904
|
+
retrievalQueries: import_v43.z.array(import_v43.z.string()).nullish(),
|
905
|
+
searchEntryPoint: import_v43.z.object({ renderedContent: import_v43.z.string() }).nullish(),
|
906
|
+
groundingChunks: import_v43.z.array(groundingChunkSchema).nullish(),
|
907
|
+
groundingSupports: import_v43.z.array(
|
908
|
+
import_v43.z.object({
|
909
|
+
segment: import_v43.z.object({
|
910
|
+
startIndex: import_v43.z.number().nullish(),
|
911
|
+
endIndex: import_v43.z.number().nullish(),
|
912
|
+
text: import_v43.z.string().nullish()
|
907
913
|
}),
|
908
|
-
segment_text:
|
909
|
-
groundingChunkIndices:
|
910
|
-
supportChunkIndices:
|
911
|
-
confidenceScores:
|
912
|
-
confidenceScore:
|
914
|
+
segment_text: import_v43.z.string().nullish(),
|
915
|
+
groundingChunkIndices: import_v43.z.array(import_v43.z.number()).nullish(),
|
916
|
+
supportChunkIndices: import_v43.z.array(import_v43.z.number()).nullish(),
|
917
|
+
confidenceScores: import_v43.z.array(import_v43.z.number()).nullish(),
|
918
|
+
confidenceScore: import_v43.z.array(import_v43.z.number()).nullish()
|
913
919
|
})
|
914
920
|
).nullish(),
|
915
|
-
retrievalMetadata:
|
916
|
-
|
917
|
-
webDynamicRetrievalScore:
|
921
|
+
retrievalMetadata: import_v43.z.union([
|
922
|
+
import_v43.z.object({
|
923
|
+
webDynamicRetrievalScore: import_v43.z.number()
|
918
924
|
}),
|
919
|
-
|
925
|
+
import_v43.z.object({})
|
920
926
|
]).nullish()
|
921
927
|
});
|
922
|
-
var safetyRatingSchema =
|
923
|
-
category:
|
924
|
-
probability:
|
925
|
-
probabilityScore:
|
926
|
-
severity:
|
927
|
-
severityScore:
|
928
|
-
blocked:
|
928
|
+
var safetyRatingSchema = import_v43.z.object({
|
929
|
+
category: import_v43.z.string().nullish(),
|
930
|
+
probability: import_v43.z.string().nullish(),
|
931
|
+
probabilityScore: import_v43.z.number().nullish(),
|
932
|
+
severity: import_v43.z.string().nullish(),
|
933
|
+
severityScore: import_v43.z.number().nullish(),
|
934
|
+
blocked: import_v43.z.boolean().nullish()
|
929
935
|
});
|
930
|
-
var usageSchema =
|
931
|
-
cachedContentTokenCount:
|
932
|
-
thoughtsTokenCount:
|
933
|
-
promptTokenCount:
|
934
|
-
candidatesTokenCount:
|
935
|
-
totalTokenCount:
|
936
|
+
var usageSchema = import_v43.z.object({
|
937
|
+
cachedContentTokenCount: import_v43.z.number().nullish(),
|
938
|
+
thoughtsTokenCount: import_v43.z.number().nullish(),
|
939
|
+
promptTokenCount: import_v43.z.number().nullish(),
|
940
|
+
candidatesTokenCount: import_v43.z.number().nullish(),
|
941
|
+
totalTokenCount: import_v43.z.number().nullish()
|
936
942
|
});
|
937
|
-
var responseSchema =
|
938
|
-
candidates:
|
939
|
-
|
940
|
-
content: contentSchema.nullish().or(
|
941
|
-
finishReason:
|
942
|
-
safetyRatings:
|
943
|
+
var responseSchema = import_v43.z.object({
|
944
|
+
candidates: import_v43.z.array(
|
945
|
+
import_v43.z.object({
|
946
|
+
content: contentSchema.nullish().or(import_v43.z.object({}).strict()),
|
947
|
+
finishReason: import_v43.z.string().nullish(),
|
948
|
+
safetyRatings: import_v43.z.array(safetyRatingSchema).nullish(),
|
943
949
|
groundingMetadata: groundingMetadataSchema.nullish()
|
944
950
|
})
|
945
951
|
),
|
946
952
|
usageMetadata: usageSchema.nullish()
|
947
953
|
});
|
948
|
-
var chunkSchema =
|
949
|
-
candidates:
|
950
|
-
|
954
|
+
var chunkSchema = import_v43.z.object({
|
955
|
+
candidates: import_v43.z.array(
|
956
|
+
import_v43.z.object({
|
951
957
|
content: contentSchema.nullish(),
|
952
|
-
finishReason:
|
953
|
-
safetyRatings:
|
958
|
+
finishReason: import_v43.z.string().nullish(),
|
959
|
+
safetyRatings: import_v43.z.array(safetyRatingSchema).nullish(),
|
954
960
|
groundingMetadata: groundingMetadataSchema.nullish()
|
955
961
|
})
|
956
962
|
).nullish(),
|