@ai-sdk/google 4.0.0-beta.36 → 4.0.0-beta.37
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 +12 -0
- package/dist/index.js +482 -415
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +297 -282
- package/dist/internal/index.js.map +1 -1
- package/package.json +9 -10
- package/dist/index.d.mts +0 -427
- package/dist/index.mjs +0 -3439
- package/dist/index.mjs.map +0 -1
- package/dist/internal/index.d.mts +0 -319
- package/dist/internal/index.mjs +0 -2458
- package/dist/internal/index.mjs.map +0 -1
package/dist/internal/index.js
CHANGED
|
@@ -1,35 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/internal/index.ts
|
|
21
|
-
var index_exports = {};
|
|
22
|
-
__export(index_exports, {
|
|
23
|
-
GoogleGenerativeAILanguageModel: () => GoogleGenerativeAILanguageModel,
|
|
24
|
-
getGroundingMetadataSchema: () => getGroundingMetadataSchema,
|
|
25
|
-
getUrlContextMetadataSchema: () => getUrlContextMetadataSchema,
|
|
26
|
-
googleTools: () => googleTools
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(index_exports);
|
|
29
|
-
|
|
30
1
|
// src/google-generative-ai-language-model.ts
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
import {
|
|
3
|
+
combineHeaders,
|
|
4
|
+
createEventSourceResponseHandler,
|
|
5
|
+
createJsonResponseHandler,
|
|
6
|
+
generateId,
|
|
7
|
+
isCustomReasoning,
|
|
8
|
+
lazySchema as lazySchema3,
|
|
9
|
+
mapReasoningToProviderBudget,
|
|
10
|
+
mapReasoningToProviderEffort,
|
|
11
|
+
parseProviderOptions,
|
|
12
|
+
postJsonToApi,
|
|
13
|
+
resolve,
|
|
14
|
+
zodSchema as zodSchema3
|
|
15
|
+
} from "@ai-sdk/provider-utils";
|
|
16
|
+
import { z as z3 } from "zod/v4";
|
|
33
17
|
|
|
34
18
|
// src/convert-google-generative-ai-usage.ts
|
|
35
19
|
function convertGoogleGenerativeAIUsage(usage) {
|
|
@@ -187,8 +171,14 @@ function isEmptyObjectSchema(jsonSchema) {
|
|
|
187
171
|
}
|
|
188
172
|
|
|
189
173
|
// src/convert-to-google-generative-ai-messages.ts
|
|
190
|
-
|
|
191
|
-
|
|
174
|
+
import {
|
|
175
|
+
UnsupportedFunctionalityError
|
|
176
|
+
} from "@ai-sdk/provider";
|
|
177
|
+
import {
|
|
178
|
+
convertToBase64,
|
|
179
|
+
isProviderReference,
|
|
180
|
+
resolveProviderReference
|
|
181
|
+
} from "@ai-sdk/provider-utils";
|
|
192
182
|
var dataUrlRegex = /^data:([^;,]+);base64,(.+)$/s;
|
|
193
183
|
function parseBase64DataUrl(value) {
|
|
194
184
|
const match = dataUrlRegex.exec(value);
|
|
@@ -305,7 +295,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
305
295
|
switch (role) {
|
|
306
296
|
case "system": {
|
|
307
297
|
if (!systemMessagesAllowed) {
|
|
308
|
-
throw new
|
|
298
|
+
throw new UnsupportedFunctionalityError({
|
|
309
299
|
functionality: "system messages are only supported at the beginning of the conversation"
|
|
310
300
|
});
|
|
311
301
|
}
|
|
@@ -330,16 +320,16 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
330
320
|
fileUri: part.data.toString()
|
|
331
321
|
}
|
|
332
322
|
});
|
|
333
|
-
} else if (
|
|
323
|
+
} else if (isProviderReference(part.data)) {
|
|
334
324
|
if (providerOptionsName === "vertex") {
|
|
335
|
-
throw new
|
|
325
|
+
throw new UnsupportedFunctionalityError({
|
|
336
326
|
functionality: "file parts with provider references"
|
|
337
327
|
});
|
|
338
328
|
}
|
|
339
329
|
parts.push({
|
|
340
330
|
fileData: {
|
|
341
331
|
mimeType: mediaType,
|
|
342
|
-
fileUri:
|
|
332
|
+
fileUri: resolveProviderReference({
|
|
343
333
|
reference: part.data,
|
|
344
334
|
provider: "google"
|
|
345
335
|
})
|
|
@@ -349,7 +339,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
349
339
|
parts.push({
|
|
350
340
|
inlineData: {
|
|
351
341
|
mimeType: mediaType,
|
|
352
|
-
data:
|
|
342
|
+
data: convertToBase64(part.data)
|
|
353
343
|
}
|
|
354
344
|
});
|
|
355
345
|
}
|
|
@@ -384,14 +374,14 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
384
374
|
}
|
|
385
375
|
case "reasoning-file": {
|
|
386
376
|
if (part.data instanceof URL) {
|
|
387
|
-
throw new
|
|
377
|
+
throw new UnsupportedFunctionalityError({
|
|
388
378
|
functionality: "File data URLs in assistant messages are not supported"
|
|
389
379
|
});
|
|
390
380
|
}
|
|
391
381
|
return {
|
|
392
382
|
inlineData: {
|
|
393
383
|
mimeType: part.mediaType,
|
|
394
|
-
data:
|
|
384
|
+
data: convertToBase64(part.data)
|
|
395
385
|
},
|
|
396
386
|
thought: true,
|
|
397
387
|
thoughtSignature
|
|
@@ -399,20 +389,20 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
399
389
|
}
|
|
400
390
|
case "file": {
|
|
401
391
|
if (part.data instanceof URL) {
|
|
402
|
-
throw new
|
|
392
|
+
throw new UnsupportedFunctionalityError({
|
|
403
393
|
functionality: "File data URLs in assistant messages are not supported"
|
|
404
394
|
});
|
|
405
395
|
}
|
|
406
|
-
if (
|
|
396
|
+
if (isProviderReference(part.data)) {
|
|
407
397
|
if (providerOptionsName === "vertex") {
|
|
408
|
-
throw new
|
|
398
|
+
throw new UnsupportedFunctionalityError({
|
|
409
399
|
functionality: "file parts with provider references"
|
|
410
400
|
});
|
|
411
401
|
}
|
|
412
402
|
return {
|
|
413
403
|
fileData: {
|
|
414
404
|
mimeType: part.mediaType,
|
|
415
|
-
fileUri:
|
|
405
|
+
fileUri: resolveProviderReference({
|
|
416
406
|
reference: part.data,
|
|
417
407
|
provider: "google"
|
|
418
408
|
})
|
|
@@ -424,7 +414,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
424
414
|
return {
|
|
425
415
|
inlineData: {
|
|
426
416
|
mimeType: part.mediaType,
|
|
427
|
-
data:
|
|
417
|
+
data: convertToBase64(part.data)
|
|
428
418
|
},
|
|
429
419
|
...(providerOpts == null ? void 0 : providerOpts.thought) === true ? { thought: true } : {},
|
|
430
420
|
thoughtSignature
|
|
@@ -541,43 +531,47 @@ function getModelPath(modelId) {
|
|
|
541
531
|
}
|
|
542
532
|
|
|
543
533
|
// src/google-error.ts
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
534
|
+
import {
|
|
535
|
+
createJsonErrorResponseHandler,
|
|
536
|
+
lazySchema,
|
|
537
|
+
zodSchema
|
|
538
|
+
} from "@ai-sdk/provider-utils";
|
|
539
|
+
import { z } from "zod/v4";
|
|
540
|
+
var googleErrorDataSchema = lazySchema(
|
|
541
|
+
() => zodSchema(
|
|
542
|
+
z.object({
|
|
543
|
+
error: z.object({
|
|
544
|
+
code: z.number().nullable(),
|
|
545
|
+
message: z.string(),
|
|
546
|
+
status: z.string()
|
|
553
547
|
})
|
|
554
548
|
})
|
|
555
549
|
)
|
|
556
550
|
);
|
|
557
|
-
var googleFailedResponseHandler =
|
|
551
|
+
var googleFailedResponseHandler = createJsonErrorResponseHandler({
|
|
558
552
|
errorSchema: googleErrorDataSchema,
|
|
559
553
|
errorToMessage: (data) => data.error.message
|
|
560
554
|
});
|
|
561
555
|
|
|
562
556
|
// src/google-generative-ai-options.ts
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
var googleLanguageModelOptions = (
|
|
566
|
-
() => (
|
|
567
|
-
|
|
568
|
-
responseModalities:
|
|
569
|
-
thinkingConfig:
|
|
570
|
-
thinkingBudget:
|
|
571
|
-
includeThoughts:
|
|
557
|
+
import { lazySchema as lazySchema2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
|
|
558
|
+
import { z as z2 } from "zod/v4";
|
|
559
|
+
var googleLanguageModelOptions = lazySchema2(
|
|
560
|
+
() => zodSchema2(
|
|
561
|
+
z2.object({
|
|
562
|
+
responseModalities: z2.array(z2.enum(["TEXT", "IMAGE"])).optional(),
|
|
563
|
+
thinkingConfig: z2.object({
|
|
564
|
+
thinkingBudget: z2.number().optional(),
|
|
565
|
+
includeThoughts: z2.boolean().optional(),
|
|
572
566
|
// https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level
|
|
573
|
-
thinkingLevel:
|
|
567
|
+
thinkingLevel: z2.enum(["minimal", "low", "medium", "high"]).optional()
|
|
574
568
|
}).optional(),
|
|
575
569
|
/**
|
|
576
570
|
* Optional.
|
|
577
571
|
* The name of the cached content used as context to serve the prediction.
|
|
578
572
|
* Format: cachedContents/{cachedContent}
|
|
579
573
|
*/
|
|
580
|
-
cachedContent:
|
|
574
|
+
cachedContent: z2.string().optional(),
|
|
581
575
|
/**
|
|
582
576
|
* Optional. Enable structured output. Default is true.
|
|
583
577
|
*
|
|
@@ -586,13 +580,13 @@ var googleLanguageModelOptions = (0, import_provider_utils3.lazySchema)(
|
|
|
586
580
|
* Google Generative AI uses. You can use this to disable
|
|
587
581
|
* structured outputs if you need to.
|
|
588
582
|
*/
|
|
589
|
-
structuredOutputs:
|
|
583
|
+
structuredOutputs: z2.boolean().optional(),
|
|
590
584
|
/**
|
|
591
585
|
* Optional. A list of unique safety settings for blocking unsafe content.
|
|
592
586
|
*/
|
|
593
|
-
safetySettings:
|
|
594
|
-
|
|
595
|
-
category:
|
|
587
|
+
safetySettings: z2.array(
|
|
588
|
+
z2.object({
|
|
589
|
+
category: z2.enum([
|
|
596
590
|
"HARM_CATEGORY_UNSPECIFIED",
|
|
597
591
|
"HARM_CATEGORY_HATE_SPEECH",
|
|
598
592
|
"HARM_CATEGORY_DANGEROUS_CONTENT",
|
|
@@ -600,7 +594,7 @@ var googleLanguageModelOptions = (0, import_provider_utils3.lazySchema)(
|
|
|
600
594
|
"HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
|
601
595
|
"HARM_CATEGORY_CIVIC_INTEGRITY"
|
|
602
596
|
]),
|
|
603
|
-
threshold:
|
|
597
|
+
threshold: z2.enum([
|
|
604
598
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
|
605
599
|
"BLOCK_LOW_AND_ABOVE",
|
|
606
600
|
"BLOCK_MEDIUM_AND_ABOVE",
|
|
@@ -610,7 +604,7 @@ var googleLanguageModelOptions = (0, import_provider_utils3.lazySchema)(
|
|
|
610
604
|
])
|
|
611
605
|
})
|
|
612
606
|
).optional(),
|
|
613
|
-
threshold:
|
|
607
|
+
threshold: z2.enum([
|
|
614
608
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
|
615
609
|
"BLOCK_LOW_AND_ABOVE",
|
|
616
610
|
"BLOCK_MEDIUM_AND_ABOVE",
|
|
@@ -623,19 +617,19 @@ var googleLanguageModelOptions = (0, import_provider_utils3.lazySchema)(
|
|
|
623
617
|
*
|
|
624
618
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
|
|
625
619
|
*/
|
|
626
|
-
audioTimestamp:
|
|
620
|
+
audioTimestamp: z2.boolean().optional(),
|
|
627
621
|
/**
|
|
628
622
|
* Optional. Defines labels used in billing reports. Available on Vertex AI only.
|
|
629
623
|
*
|
|
630
624
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
|
|
631
625
|
*/
|
|
632
|
-
labels:
|
|
626
|
+
labels: z2.record(z2.string(), z2.string()).optional(),
|
|
633
627
|
/**
|
|
634
628
|
* Optional. If specified, the media resolution specified will be used.
|
|
635
629
|
*
|
|
636
630
|
* https://ai.google.dev/api/generate-content#MediaResolution
|
|
637
631
|
*/
|
|
638
|
-
mediaResolution:
|
|
632
|
+
mediaResolution: z2.enum([
|
|
639
633
|
"MEDIA_RESOLUTION_UNSPECIFIED",
|
|
640
634
|
"MEDIA_RESOLUTION_LOW",
|
|
641
635
|
"MEDIA_RESOLUTION_MEDIUM",
|
|
@@ -646,8 +640,8 @@ var googleLanguageModelOptions = (0, import_provider_utils3.lazySchema)(
|
|
|
646
640
|
*
|
|
647
641
|
* https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios
|
|
648
642
|
*/
|
|
649
|
-
imageConfig:
|
|
650
|
-
aspectRatio:
|
|
643
|
+
imageConfig: z2.object({
|
|
644
|
+
aspectRatio: z2.enum([
|
|
651
645
|
"1:1",
|
|
652
646
|
"2:3",
|
|
653
647
|
"3:2",
|
|
@@ -663,7 +657,7 @@ var googleLanguageModelOptions = (0, import_provider_utils3.lazySchema)(
|
|
|
663
657
|
"1:4",
|
|
664
658
|
"4:1"
|
|
665
659
|
]).optional(),
|
|
666
|
-
imageSize:
|
|
660
|
+
imageSize: z2.enum(["1K", "2K", "4K", "512"]).optional()
|
|
667
661
|
}).optional(),
|
|
668
662
|
/**
|
|
669
663
|
* Optional. Configuration for grounding retrieval.
|
|
@@ -671,10 +665,10 @@ var googleLanguageModelOptions = (0, import_provider_utils3.lazySchema)(
|
|
|
671
665
|
*
|
|
672
666
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
673
667
|
*/
|
|
674
|
-
retrievalConfig:
|
|
675
|
-
latLng:
|
|
676
|
-
latitude:
|
|
677
|
-
longitude:
|
|
668
|
+
retrievalConfig: z2.object({
|
|
669
|
+
latLng: z2.object({
|
|
670
|
+
latitude: z2.number(),
|
|
671
|
+
longitude: z2.number()
|
|
678
672
|
}).optional()
|
|
679
673
|
}).optional(),
|
|
680
674
|
/**
|
|
@@ -687,11 +681,11 @@ var googleLanguageModelOptions = (0, import_provider_utils3.lazySchema)(
|
|
|
687
681
|
*
|
|
688
682
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc
|
|
689
683
|
*/
|
|
690
|
-
streamFunctionCallArguments:
|
|
684
|
+
streamFunctionCallArguments: z2.boolean().optional(),
|
|
691
685
|
/**
|
|
692
686
|
* Optional. The service tier to use for the request.
|
|
693
687
|
*/
|
|
694
|
-
serviceTier:
|
|
688
|
+
serviceTier: z2.enum(["standard", "flex", "priority"]).optional()
|
|
695
689
|
})
|
|
696
690
|
)
|
|
697
691
|
);
|
|
@@ -702,7 +696,9 @@ var VertexServiceTierMap = {
|
|
|
702
696
|
};
|
|
703
697
|
|
|
704
698
|
// src/google-prepare-tools.ts
|
|
705
|
-
|
|
699
|
+
import {
|
|
700
|
+
UnsupportedFunctionalityError as UnsupportedFunctionalityError2
|
|
701
|
+
} from "@ai-sdk/provider";
|
|
706
702
|
function prepareTools({
|
|
707
703
|
tools,
|
|
708
704
|
toolChoice,
|
|
@@ -944,7 +940,7 @@ function prepareTools({
|
|
|
944
940
|
};
|
|
945
941
|
default: {
|
|
946
942
|
const _exhaustiveCheck = type;
|
|
947
|
-
throw new
|
|
943
|
+
throw new UnsupportedFunctionalityError2({
|
|
948
944
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
949
945
|
});
|
|
950
946
|
}
|
|
@@ -1207,7 +1203,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1207
1203
|
var _a;
|
|
1208
1204
|
this.modelId = modelId;
|
|
1209
1205
|
this.config = config;
|
|
1210
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
1206
|
+
this.generateId = (_a = config.generateId) != null ? _a : generateId;
|
|
1211
1207
|
}
|
|
1212
1208
|
get provider() {
|
|
1213
1209
|
return this.config.provider;
|
|
@@ -1235,13 +1231,13 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1235
1231
|
var _a, _b;
|
|
1236
1232
|
const warnings = [];
|
|
1237
1233
|
const providerOptionsName = this.config.provider.includes("vertex") ? "vertex" : "google";
|
|
1238
|
-
let googleOptions = await
|
|
1234
|
+
let googleOptions = await parseProviderOptions({
|
|
1239
1235
|
provider: providerOptionsName,
|
|
1240
1236
|
providerOptions,
|
|
1241
1237
|
schema: googleLanguageModelOptions
|
|
1242
1238
|
});
|
|
1243
1239
|
if (googleOptions == null && providerOptionsName !== "google") {
|
|
1244
|
-
googleOptions = await
|
|
1240
|
+
googleOptions = await parseProviderOptions({
|
|
1245
1241
|
provider: "google",
|
|
1246
1242
|
providerOptions,
|
|
1247
1243
|
schema: googleLanguageModelOptions
|
|
@@ -1351,22 +1347,22 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1351
1347
|
async doGenerate(options) {
|
|
1352
1348
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
1353
1349
|
const { args, warnings, providerOptionsName } = await this.getArgs(options);
|
|
1354
|
-
const mergedHeaders =
|
|
1355
|
-
await
|
|
1350
|
+
const mergedHeaders = combineHeaders(
|
|
1351
|
+
await resolve(this.config.headers),
|
|
1356
1352
|
options.headers
|
|
1357
1353
|
);
|
|
1358
1354
|
const {
|
|
1359
1355
|
responseHeaders,
|
|
1360
1356
|
value: response,
|
|
1361
1357
|
rawValue: rawResponse
|
|
1362
|
-
} = await
|
|
1358
|
+
} = await postJsonToApi({
|
|
1363
1359
|
url: `${this.config.baseURL}/${getModelPath(
|
|
1364
1360
|
this.modelId
|
|
1365
1361
|
)}:generateContent`,
|
|
1366
1362
|
headers: mergedHeaders,
|
|
1367
1363
|
body: args,
|
|
1368
1364
|
failedResponseHandler: googleFailedResponseHandler,
|
|
1369
|
-
successfulResponseHandler:
|
|
1365
|
+
successfulResponseHandler: createJsonResponseHandler(responseSchema),
|
|
1370
1366
|
abortSignal: options.abortSignal,
|
|
1371
1367
|
fetch: this.config.fetch
|
|
1372
1368
|
});
|
|
@@ -1533,18 +1529,18 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1533
1529
|
options,
|
|
1534
1530
|
{ isStreaming: true }
|
|
1535
1531
|
);
|
|
1536
|
-
const headers =
|
|
1537
|
-
await
|
|
1532
|
+
const headers = combineHeaders(
|
|
1533
|
+
await resolve(this.config.headers),
|
|
1538
1534
|
options.headers
|
|
1539
1535
|
);
|
|
1540
|
-
const { responseHeaders, value: response } = await
|
|
1536
|
+
const { responseHeaders, value: response } = await postJsonToApi({
|
|
1541
1537
|
url: `${this.config.baseURL}/${getModelPath(
|
|
1542
1538
|
this.modelId
|
|
1543
1539
|
)}:streamGenerateContent?alt=sse`,
|
|
1544
1540
|
headers,
|
|
1545
1541
|
body: args,
|
|
1546
1542
|
failedResponseHandler: googleFailedResponseHandler,
|
|
1547
|
-
successfulResponseHandler:
|
|
1543
|
+
successfulResponseHandler: createEventSourceResponseHandler(chunkSchema),
|
|
1548
1544
|
abortSignal: options.abortSignal,
|
|
1549
1545
|
fetch: this.config.fetch
|
|
1550
1546
|
});
|
|
@@ -1940,7 +1936,7 @@ function resolveThinkingConfig({
|
|
|
1940
1936
|
modelId,
|
|
1941
1937
|
warnings
|
|
1942
1938
|
}) {
|
|
1943
|
-
if (!
|
|
1939
|
+
if (!isCustomReasoning(reasoning)) {
|
|
1944
1940
|
return void 0;
|
|
1945
1941
|
}
|
|
1946
1942
|
if (isGemini3Model(modelId) && !modelId.includes("gemini-3-pro-image")) {
|
|
@@ -1955,7 +1951,7 @@ function resolveGemini3ThinkingConfig({
|
|
|
1955
1951
|
if (reasoning === "none") {
|
|
1956
1952
|
return { thinkingLevel: "minimal" };
|
|
1957
1953
|
}
|
|
1958
|
-
const thinkingLevel =
|
|
1954
|
+
const thinkingLevel = mapReasoningToProviderEffort({
|
|
1959
1955
|
reasoning,
|
|
1960
1956
|
effortMap: {
|
|
1961
1957
|
minimal: "minimal",
|
|
@@ -1979,7 +1975,7 @@ function resolveGemini25ThinkingConfig({
|
|
|
1979
1975
|
if (reasoning === "none") {
|
|
1980
1976
|
return { thinkingBudget: 0 };
|
|
1981
1977
|
}
|
|
1982
|
-
const thinkingBudget =
|
|
1978
|
+
const thinkingBudget = mapReasoningToProviderBudget({
|
|
1983
1979
|
reasoning,
|
|
1984
1980
|
maxOutputTokens: getMaxOutputTokensForGemini25Model(),
|
|
1985
1981
|
maxReasoningBudget: getMaxThinkingTokensForGemini25Model(modelId),
|
|
@@ -2085,270 +2081,286 @@ function extractSources({
|
|
|
2085
2081
|
}
|
|
2086
2082
|
return sources.length > 0 ? sources : void 0;
|
|
2087
2083
|
}
|
|
2088
|
-
var getGroundingMetadataSchema = () =>
|
|
2089
|
-
webSearchQueries:
|
|
2090
|
-
imageSearchQueries:
|
|
2091
|
-
retrievalQueries:
|
|
2092
|
-
searchEntryPoint:
|
|
2093
|
-
groundingChunks:
|
|
2094
|
-
|
|
2095
|
-
web:
|
|
2096
|
-
image:
|
|
2097
|
-
sourceUri:
|
|
2098
|
-
imageUri:
|
|
2099
|
-
title:
|
|
2100
|
-
domain:
|
|
2084
|
+
var getGroundingMetadataSchema = () => z3.object({
|
|
2085
|
+
webSearchQueries: z3.array(z3.string()).nullish(),
|
|
2086
|
+
imageSearchQueries: z3.array(z3.string()).nullish(),
|
|
2087
|
+
retrievalQueries: z3.array(z3.string()).nullish(),
|
|
2088
|
+
searchEntryPoint: z3.object({ renderedContent: z3.string() }).nullish(),
|
|
2089
|
+
groundingChunks: z3.array(
|
|
2090
|
+
z3.object({
|
|
2091
|
+
web: z3.object({ uri: z3.string(), title: z3.string().nullish() }).nullish(),
|
|
2092
|
+
image: z3.object({
|
|
2093
|
+
sourceUri: z3.string(),
|
|
2094
|
+
imageUri: z3.string(),
|
|
2095
|
+
title: z3.string().nullish(),
|
|
2096
|
+
domain: z3.string().nullish()
|
|
2101
2097
|
}).nullish(),
|
|
2102
|
-
retrievedContext:
|
|
2103
|
-
uri:
|
|
2104
|
-
title:
|
|
2105
|
-
text:
|
|
2106
|
-
fileSearchStore:
|
|
2098
|
+
retrievedContext: z3.object({
|
|
2099
|
+
uri: z3.string().nullish(),
|
|
2100
|
+
title: z3.string().nullish(),
|
|
2101
|
+
text: z3.string().nullish(),
|
|
2102
|
+
fileSearchStore: z3.string().nullish()
|
|
2107
2103
|
}).nullish(),
|
|
2108
|
-
maps:
|
|
2109
|
-
uri:
|
|
2110
|
-
title:
|
|
2111
|
-
text:
|
|
2112
|
-
placeId:
|
|
2104
|
+
maps: z3.object({
|
|
2105
|
+
uri: z3.string().nullish(),
|
|
2106
|
+
title: z3.string().nullish(),
|
|
2107
|
+
text: z3.string().nullish(),
|
|
2108
|
+
placeId: z3.string().nullish()
|
|
2113
2109
|
}).nullish()
|
|
2114
2110
|
})
|
|
2115
2111
|
).nullish(),
|
|
2116
|
-
groundingSupports:
|
|
2117
|
-
|
|
2118
|
-
segment:
|
|
2119
|
-
startIndex:
|
|
2120
|
-
endIndex:
|
|
2121
|
-
text:
|
|
2112
|
+
groundingSupports: z3.array(
|
|
2113
|
+
z3.object({
|
|
2114
|
+
segment: z3.object({
|
|
2115
|
+
startIndex: z3.number().nullish(),
|
|
2116
|
+
endIndex: z3.number().nullish(),
|
|
2117
|
+
text: z3.string().nullish()
|
|
2122
2118
|
}).nullish(),
|
|
2123
|
-
segment_text:
|
|
2124
|
-
groundingChunkIndices:
|
|
2125
|
-
supportChunkIndices:
|
|
2126
|
-
confidenceScores:
|
|
2127
|
-
confidenceScore:
|
|
2119
|
+
segment_text: z3.string().nullish(),
|
|
2120
|
+
groundingChunkIndices: z3.array(z3.number()).nullish(),
|
|
2121
|
+
supportChunkIndices: z3.array(z3.number()).nullish(),
|
|
2122
|
+
confidenceScores: z3.array(z3.number()).nullish(),
|
|
2123
|
+
confidenceScore: z3.array(z3.number()).nullish()
|
|
2128
2124
|
})
|
|
2129
2125
|
).nullish(),
|
|
2130
|
-
retrievalMetadata:
|
|
2131
|
-
|
|
2132
|
-
webDynamicRetrievalScore:
|
|
2126
|
+
retrievalMetadata: z3.union([
|
|
2127
|
+
z3.object({
|
|
2128
|
+
webDynamicRetrievalScore: z3.number()
|
|
2133
2129
|
}),
|
|
2134
|
-
|
|
2130
|
+
z3.object({})
|
|
2135
2131
|
]).nullish()
|
|
2136
2132
|
});
|
|
2137
|
-
var partialArgSchema =
|
|
2138
|
-
jsonPath:
|
|
2139
|
-
stringValue:
|
|
2140
|
-
numberValue:
|
|
2141
|
-
boolValue:
|
|
2142
|
-
nullValue:
|
|
2143
|
-
willContinue:
|
|
2133
|
+
var partialArgSchema = z3.object({
|
|
2134
|
+
jsonPath: z3.string(),
|
|
2135
|
+
stringValue: z3.string().nullish(),
|
|
2136
|
+
numberValue: z3.number().nullish(),
|
|
2137
|
+
boolValue: z3.boolean().nullish(),
|
|
2138
|
+
nullValue: z3.unknown().nullish(),
|
|
2139
|
+
willContinue: z3.boolean().nullish()
|
|
2144
2140
|
});
|
|
2145
|
-
var getContentSchema = () =>
|
|
2146
|
-
parts:
|
|
2147
|
-
|
|
2141
|
+
var getContentSchema = () => z3.object({
|
|
2142
|
+
parts: z3.array(
|
|
2143
|
+
z3.union([
|
|
2148
2144
|
// note: order matters since text can be fully empty
|
|
2149
|
-
|
|
2150
|
-
functionCall:
|
|
2151
|
-
name:
|
|
2152
|
-
args:
|
|
2153
|
-
partialArgs:
|
|
2154
|
-
willContinue:
|
|
2145
|
+
z3.object({
|
|
2146
|
+
functionCall: z3.object({
|
|
2147
|
+
name: z3.string().nullish(),
|
|
2148
|
+
args: z3.unknown().nullish(),
|
|
2149
|
+
partialArgs: z3.array(partialArgSchema).nullish(),
|
|
2150
|
+
willContinue: z3.boolean().nullish()
|
|
2155
2151
|
}),
|
|
2156
|
-
thoughtSignature:
|
|
2152
|
+
thoughtSignature: z3.string().nullish()
|
|
2157
2153
|
}),
|
|
2158
|
-
|
|
2159
|
-
inlineData:
|
|
2160
|
-
mimeType:
|
|
2161
|
-
data:
|
|
2154
|
+
z3.object({
|
|
2155
|
+
inlineData: z3.object({
|
|
2156
|
+
mimeType: z3.string(),
|
|
2157
|
+
data: z3.string()
|
|
2162
2158
|
}),
|
|
2163
|
-
thought:
|
|
2164
|
-
thoughtSignature:
|
|
2159
|
+
thought: z3.boolean().nullish(),
|
|
2160
|
+
thoughtSignature: z3.string().nullish()
|
|
2165
2161
|
}),
|
|
2166
|
-
|
|
2167
|
-
toolCall:
|
|
2168
|
-
toolType:
|
|
2169
|
-
args:
|
|
2170
|
-
id:
|
|
2162
|
+
z3.object({
|
|
2163
|
+
toolCall: z3.object({
|
|
2164
|
+
toolType: z3.string(),
|
|
2165
|
+
args: z3.unknown().nullish(),
|
|
2166
|
+
id: z3.string()
|
|
2171
2167
|
}),
|
|
2172
|
-
thoughtSignature:
|
|
2168
|
+
thoughtSignature: z3.string().nullish()
|
|
2173
2169
|
}),
|
|
2174
|
-
|
|
2175
|
-
toolResponse:
|
|
2176
|
-
toolType:
|
|
2177
|
-
response:
|
|
2178
|
-
id:
|
|
2170
|
+
z3.object({
|
|
2171
|
+
toolResponse: z3.object({
|
|
2172
|
+
toolType: z3.string(),
|
|
2173
|
+
response: z3.unknown().nullish(),
|
|
2174
|
+
id: z3.string()
|
|
2179
2175
|
}),
|
|
2180
|
-
thoughtSignature:
|
|
2176
|
+
thoughtSignature: z3.string().nullish()
|
|
2181
2177
|
}),
|
|
2182
|
-
|
|
2183
|
-
executableCode:
|
|
2184
|
-
language:
|
|
2185
|
-
code:
|
|
2178
|
+
z3.object({
|
|
2179
|
+
executableCode: z3.object({
|
|
2180
|
+
language: z3.string(),
|
|
2181
|
+
code: z3.string()
|
|
2186
2182
|
}).nullish(),
|
|
2187
|
-
codeExecutionResult:
|
|
2188
|
-
outcome:
|
|
2189
|
-
output:
|
|
2183
|
+
codeExecutionResult: z3.object({
|
|
2184
|
+
outcome: z3.string(),
|
|
2185
|
+
output: z3.string().nullish()
|
|
2190
2186
|
}).nullish(),
|
|
2191
|
-
text:
|
|
2192
|
-
thought:
|
|
2193
|
-
thoughtSignature:
|
|
2187
|
+
text: z3.string().nullish(),
|
|
2188
|
+
thought: z3.boolean().nullish(),
|
|
2189
|
+
thoughtSignature: z3.string().nullish()
|
|
2194
2190
|
})
|
|
2195
2191
|
])
|
|
2196
2192
|
).nullish()
|
|
2197
2193
|
});
|
|
2198
|
-
var getSafetyRatingSchema = () =>
|
|
2199
|
-
category:
|
|
2200
|
-
probability:
|
|
2201
|
-
probabilityScore:
|
|
2202
|
-
severity:
|
|
2203
|
-
severityScore:
|
|
2204
|
-
blocked:
|
|
2194
|
+
var getSafetyRatingSchema = () => z3.object({
|
|
2195
|
+
category: z3.string().nullish(),
|
|
2196
|
+
probability: z3.string().nullish(),
|
|
2197
|
+
probabilityScore: z3.number().nullish(),
|
|
2198
|
+
severity: z3.string().nullish(),
|
|
2199
|
+
severityScore: z3.number().nullish(),
|
|
2200
|
+
blocked: z3.boolean().nullish()
|
|
2205
2201
|
});
|
|
2206
|
-
var tokenDetailsSchema =
|
|
2207
|
-
|
|
2208
|
-
modality:
|
|
2209
|
-
tokenCount:
|
|
2202
|
+
var tokenDetailsSchema = z3.array(
|
|
2203
|
+
z3.object({
|
|
2204
|
+
modality: z3.string(),
|
|
2205
|
+
tokenCount: z3.number()
|
|
2210
2206
|
})
|
|
2211
2207
|
).nullish();
|
|
2212
|
-
var usageSchema =
|
|
2213
|
-
cachedContentTokenCount:
|
|
2214
|
-
thoughtsTokenCount:
|
|
2215
|
-
promptTokenCount:
|
|
2216
|
-
candidatesTokenCount:
|
|
2217
|
-
totalTokenCount:
|
|
2208
|
+
var usageSchema = z3.object({
|
|
2209
|
+
cachedContentTokenCount: z3.number().nullish(),
|
|
2210
|
+
thoughtsTokenCount: z3.number().nullish(),
|
|
2211
|
+
promptTokenCount: z3.number().nullish(),
|
|
2212
|
+
candidatesTokenCount: z3.number().nullish(),
|
|
2213
|
+
totalTokenCount: z3.number().nullish(),
|
|
2218
2214
|
// https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType
|
|
2219
|
-
trafficType:
|
|
2215
|
+
trafficType: z3.string().nullish(),
|
|
2220
2216
|
// https://ai.google.dev/api/generate-content#Modality
|
|
2221
2217
|
promptTokensDetails: tokenDetailsSchema,
|
|
2222
2218
|
candidatesTokensDetails: tokenDetailsSchema
|
|
2223
2219
|
});
|
|
2224
|
-
var getUrlContextMetadataSchema = () =>
|
|
2225
|
-
urlMetadata:
|
|
2226
|
-
|
|
2227
|
-
retrievedUrl:
|
|
2228
|
-
urlRetrievalStatus:
|
|
2220
|
+
var getUrlContextMetadataSchema = () => z3.object({
|
|
2221
|
+
urlMetadata: z3.array(
|
|
2222
|
+
z3.object({
|
|
2223
|
+
retrievedUrl: z3.string(),
|
|
2224
|
+
urlRetrievalStatus: z3.string()
|
|
2229
2225
|
})
|
|
2230
2226
|
).nullish()
|
|
2231
2227
|
});
|
|
2232
|
-
var responseSchema = (
|
|
2233
|
-
() => (
|
|
2234
|
-
|
|
2235
|
-
candidates:
|
|
2236
|
-
|
|
2237
|
-
content: getContentSchema().nullish().or(
|
|
2238
|
-
finishReason:
|
|
2239
|
-
finishMessage:
|
|
2240
|
-
safetyRatings:
|
|
2228
|
+
var responseSchema = lazySchema3(
|
|
2229
|
+
() => zodSchema3(
|
|
2230
|
+
z3.object({
|
|
2231
|
+
candidates: z3.array(
|
|
2232
|
+
z3.object({
|
|
2233
|
+
content: getContentSchema().nullish().or(z3.object({}).strict()),
|
|
2234
|
+
finishReason: z3.string().nullish(),
|
|
2235
|
+
finishMessage: z3.string().nullish(),
|
|
2236
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
|
|
2241
2237
|
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
|
2242
2238
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2243
2239
|
})
|
|
2244
2240
|
),
|
|
2245
2241
|
usageMetadata: usageSchema.nullish(),
|
|
2246
|
-
promptFeedback:
|
|
2247
|
-
blockReason:
|
|
2248
|
-
safetyRatings:
|
|
2242
|
+
promptFeedback: z3.object({
|
|
2243
|
+
blockReason: z3.string().nullish(),
|
|
2244
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
|
|
2249
2245
|
}).nullish(),
|
|
2250
|
-
serviceTier:
|
|
2246
|
+
serviceTier: z3.string().nullish()
|
|
2251
2247
|
})
|
|
2252
2248
|
)
|
|
2253
2249
|
);
|
|
2254
|
-
var chunkSchema = (
|
|
2255
|
-
() => (
|
|
2256
|
-
|
|
2257
|
-
candidates:
|
|
2258
|
-
|
|
2250
|
+
var chunkSchema = lazySchema3(
|
|
2251
|
+
() => zodSchema3(
|
|
2252
|
+
z3.object({
|
|
2253
|
+
candidates: z3.array(
|
|
2254
|
+
z3.object({
|
|
2259
2255
|
content: getContentSchema().nullish(),
|
|
2260
|
-
finishReason:
|
|
2261
|
-
finishMessage:
|
|
2262
|
-
safetyRatings:
|
|
2256
|
+
finishReason: z3.string().nullish(),
|
|
2257
|
+
finishMessage: z3.string().nullish(),
|
|
2258
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
|
|
2263
2259
|
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
|
2264
2260
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2265
2261
|
})
|
|
2266
2262
|
).nullish(),
|
|
2267
2263
|
usageMetadata: usageSchema.nullish(),
|
|
2268
|
-
promptFeedback:
|
|
2269
|
-
blockReason:
|
|
2270
|
-
safetyRatings:
|
|
2264
|
+
promptFeedback: z3.object({
|
|
2265
|
+
blockReason: z3.string().nullish(),
|
|
2266
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
|
|
2271
2267
|
}).nullish(),
|
|
2272
|
-
serviceTier:
|
|
2268
|
+
serviceTier: z3.string().nullish()
|
|
2273
2269
|
})
|
|
2274
2270
|
)
|
|
2275
2271
|
);
|
|
2276
2272
|
|
|
2277
2273
|
// src/tool/code-execution.ts
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
var codeExecution =
|
|
2274
|
+
import { createProviderToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
|
|
2275
|
+
import { z as z4 } from "zod/v4";
|
|
2276
|
+
var codeExecution = createProviderToolFactoryWithOutputSchema({
|
|
2281
2277
|
id: "google.code_execution",
|
|
2282
|
-
inputSchema:
|
|
2283
|
-
language:
|
|
2284
|
-
code:
|
|
2278
|
+
inputSchema: z4.object({
|
|
2279
|
+
language: z4.string().describe("The programming language of the code."),
|
|
2280
|
+
code: z4.string().describe("The code to be executed.")
|
|
2285
2281
|
}),
|
|
2286
|
-
outputSchema:
|
|
2287
|
-
outcome:
|
|
2288
|
-
output:
|
|
2282
|
+
outputSchema: z4.object({
|
|
2283
|
+
outcome: z4.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
|
|
2284
|
+
output: z4.string().describe("The output from the code execution.")
|
|
2289
2285
|
})
|
|
2290
2286
|
});
|
|
2291
2287
|
|
|
2292
2288
|
// src/tool/enterprise-web-search.ts
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2289
|
+
import {
|
|
2290
|
+
createProviderToolFactory,
|
|
2291
|
+
lazySchema as lazySchema4,
|
|
2292
|
+
zodSchema as zodSchema4
|
|
2293
|
+
} from "@ai-sdk/provider-utils";
|
|
2294
|
+
import { z as z5 } from "zod/v4";
|
|
2295
|
+
var enterpriseWebSearch = createProviderToolFactory({
|
|
2296
2296
|
id: "google.enterprise_web_search",
|
|
2297
|
-
inputSchema: (
|
|
2297
|
+
inputSchema: lazySchema4(() => zodSchema4(z5.object({})))
|
|
2298
2298
|
});
|
|
2299
2299
|
|
|
2300
2300
|
// src/tool/file-search.ts
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2301
|
+
import {
|
|
2302
|
+
createProviderToolFactory as createProviderToolFactory2,
|
|
2303
|
+
lazySchema as lazySchema5,
|
|
2304
|
+
zodSchema as zodSchema5
|
|
2305
|
+
} from "@ai-sdk/provider-utils";
|
|
2306
|
+
import { z as z6 } from "zod/v4";
|
|
2307
|
+
var fileSearchArgsBaseSchema = z6.object({
|
|
2304
2308
|
/** The names of the file_search_stores to retrieve from.
|
|
2305
2309
|
* Example: `fileSearchStores/my-file-search-store-123`
|
|
2306
2310
|
*/
|
|
2307
|
-
fileSearchStoreNames:
|
|
2311
|
+
fileSearchStoreNames: z6.array(z6.string()).describe(
|
|
2308
2312
|
"The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
|
|
2309
2313
|
),
|
|
2310
2314
|
/** The number of file search retrieval chunks to retrieve. */
|
|
2311
|
-
topK:
|
|
2315
|
+
topK: z6.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
|
|
2312
2316
|
/** Metadata filter to apply to the file search retrieval documents.
|
|
2313
2317
|
* See https://google.aip.dev/160 for the syntax of the filter expression.
|
|
2314
2318
|
*/
|
|
2315
|
-
metadataFilter:
|
|
2319
|
+
metadataFilter: z6.string().describe(
|
|
2316
2320
|
"Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
|
|
2317
2321
|
).optional()
|
|
2318
2322
|
}).passthrough();
|
|
2319
|
-
var fileSearchArgsSchema = (
|
|
2320
|
-
() => (
|
|
2323
|
+
var fileSearchArgsSchema = lazySchema5(
|
|
2324
|
+
() => zodSchema5(fileSearchArgsBaseSchema)
|
|
2321
2325
|
);
|
|
2322
|
-
var fileSearch = (
|
|
2326
|
+
var fileSearch = createProviderToolFactory2({
|
|
2323
2327
|
id: "google.file_search",
|
|
2324
2328
|
inputSchema: fileSearchArgsSchema
|
|
2325
2329
|
});
|
|
2326
2330
|
|
|
2327
2331
|
// src/tool/google-maps.ts
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2332
|
+
import {
|
|
2333
|
+
createProviderToolFactory as createProviderToolFactory3,
|
|
2334
|
+
lazySchema as lazySchema6,
|
|
2335
|
+
zodSchema as zodSchema6
|
|
2336
|
+
} from "@ai-sdk/provider-utils";
|
|
2337
|
+
import { z as z7 } from "zod/v4";
|
|
2338
|
+
var googleMaps = createProviderToolFactory3({
|
|
2331
2339
|
id: "google.google_maps",
|
|
2332
|
-
inputSchema: (
|
|
2340
|
+
inputSchema: lazySchema6(() => zodSchema6(z7.object({})))
|
|
2333
2341
|
});
|
|
2334
2342
|
|
|
2335
2343
|
// src/tool/google-search.ts
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2344
|
+
import {
|
|
2345
|
+
createProviderToolFactory as createProviderToolFactory4,
|
|
2346
|
+
lazySchema as lazySchema7,
|
|
2347
|
+
zodSchema as zodSchema7
|
|
2348
|
+
} from "@ai-sdk/provider-utils";
|
|
2349
|
+
import { z as z8 } from "zod/v4";
|
|
2350
|
+
var googleSearchToolArgsBaseSchema = z8.object({
|
|
2351
|
+
searchTypes: z8.object({
|
|
2352
|
+
webSearch: z8.object({}).optional(),
|
|
2353
|
+
imageSearch: z8.object({}).optional()
|
|
2342
2354
|
}).optional(),
|
|
2343
|
-
timeRangeFilter:
|
|
2344
|
-
startTime:
|
|
2345
|
-
endTime:
|
|
2355
|
+
timeRangeFilter: z8.object({
|
|
2356
|
+
startTime: z8.string(),
|
|
2357
|
+
endTime: z8.string()
|
|
2346
2358
|
}).optional()
|
|
2347
2359
|
}).passthrough();
|
|
2348
|
-
var googleSearchToolArgsSchema = (
|
|
2349
|
-
() => (
|
|
2360
|
+
var googleSearchToolArgsSchema = lazySchema7(
|
|
2361
|
+
() => zodSchema7(googleSearchToolArgsBaseSchema)
|
|
2350
2362
|
);
|
|
2351
|
-
var googleSearch = (
|
|
2363
|
+
var googleSearch = createProviderToolFactory4(
|
|
2352
2364
|
{
|
|
2353
2365
|
id: "google.google_search",
|
|
2354
2366
|
inputSchema: googleSearchToolArgsSchema
|
|
@@ -2356,21 +2368,25 @@ var googleSearch = (0, import_provider_utils9.createProviderToolFactory)(
|
|
|
2356
2368
|
);
|
|
2357
2369
|
|
|
2358
2370
|
// src/tool/url-context.ts
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2371
|
+
import {
|
|
2372
|
+
createProviderToolFactory as createProviderToolFactory5,
|
|
2373
|
+
lazySchema as lazySchema8,
|
|
2374
|
+
zodSchema as zodSchema8
|
|
2375
|
+
} from "@ai-sdk/provider-utils";
|
|
2376
|
+
import { z as z9 } from "zod/v4";
|
|
2377
|
+
var urlContext = createProviderToolFactory5({
|
|
2362
2378
|
id: "google.url_context",
|
|
2363
|
-
inputSchema: (
|
|
2379
|
+
inputSchema: lazySchema8(() => zodSchema8(z9.object({})))
|
|
2364
2380
|
});
|
|
2365
2381
|
|
|
2366
2382
|
// src/tool/vertex-rag-store.ts
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
var vertexRagStore = (
|
|
2383
|
+
import { createProviderToolFactory as createProviderToolFactory6 } from "@ai-sdk/provider-utils";
|
|
2384
|
+
import { z as z10 } from "zod/v4";
|
|
2385
|
+
var vertexRagStore = createProviderToolFactory6({
|
|
2370
2386
|
id: "google.vertex_rag_store",
|
|
2371
|
-
inputSchema:
|
|
2372
|
-
ragCorpus:
|
|
2373
|
-
topK:
|
|
2387
|
+
inputSchema: z10.object({
|
|
2388
|
+
ragCorpus: z10.string(),
|
|
2389
|
+
topK: z10.number().optional()
|
|
2374
2390
|
})
|
|
2375
2391
|
});
|
|
2376
2392
|
|
|
@@ -2433,11 +2449,10 @@ var googleTools = {
|
|
|
2433
2449
|
*/
|
|
2434
2450
|
vertexRagStore
|
|
2435
2451
|
};
|
|
2436
|
-
|
|
2437
|
-
0 && (module.exports = {
|
|
2452
|
+
export {
|
|
2438
2453
|
GoogleGenerativeAILanguageModel,
|
|
2439
2454
|
getGroundingMetadataSchema,
|
|
2440
2455
|
getUrlContextMetadataSchema,
|
|
2441
2456
|
googleTools
|
|
2442
|
-
}
|
|
2457
|
+
};
|
|
2443
2458
|
//# sourceMappingURL=index.js.map
|