@ai-sdk/google 4.0.0-beta.35 → 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 +18 -0
- package/dist/index.js +492 -416
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +307 -283
- package/dist/internal/index.js.map +1 -1
- package/package.json +9 -10
- package/src/google-generative-ai-language-model.ts +8 -1
- package/src/google-generative-ai-options.ts +7 -0
- package/dist/index.d.mts +0 -427
- package/dist/index.mjs +0 -3430
- package/dist/index.mjs.map +0 -1
- package/dist/internal/index.d.mts +0 -319
- package/dist/internal/index.mjs +0 -2449
- 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,17 +681,24 @@ 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
|
);
|
|
692
|
+
var VertexServiceTierMap = {
|
|
693
|
+
standard: "SERVICE_TIER_STANDARD",
|
|
694
|
+
flex: "SERVICE_TIER_FLEX",
|
|
695
|
+
priority: "SERVICE_TIER_PRIORITY"
|
|
696
|
+
};
|
|
698
697
|
|
|
699
698
|
// src/google-prepare-tools.ts
|
|
700
|
-
|
|
699
|
+
import {
|
|
700
|
+
UnsupportedFunctionalityError as UnsupportedFunctionalityError2
|
|
701
|
+
} from "@ai-sdk/provider";
|
|
701
702
|
function prepareTools({
|
|
702
703
|
tools,
|
|
703
704
|
toolChoice,
|
|
@@ -939,7 +940,7 @@ function prepareTools({
|
|
|
939
940
|
};
|
|
940
941
|
default: {
|
|
941
942
|
const _exhaustiveCheck = type;
|
|
942
|
-
throw new
|
|
943
|
+
throw new UnsupportedFunctionalityError2({
|
|
943
944
|
functionality: `tool choice type: ${_exhaustiveCheck}`
|
|
944
945
|
});
|
|
945
946
|
}
|
|
@@ -1202,7 +1203,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1202
1203
|
var _a;
|
|
1203
1204
|
this.modelId = modelId;
|
|
1204
1205
|
this.config = config;
|
|
1205
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
|
1206
|
+
this.generateId = (_a = config.generateId) != null ? _a : generateId;
|
|
1206
1207
|
}
|
|
1207
1208
|
get provider() {
|
|
1208
1209
|
return this.config.provider;
|
|
@@ -1230,13 +1231,13 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1230
1231
|
var _a, _b;
|
|
1231
1232
|
const warnings = [];
|
|
1232
1233
|
const providerOptionsName = this.config.provider.includes("vertex") ? "vertex" : "google";
|
|
1233
|
-
let googleOptions = await
|
|
1234
|
+
let googleOptions = await parseProviderOptions({
|
|
1234
1235
|
provider: providerOptionsName,
|
|
1235
1236
|
providerOptions,
|
|
1236
1237
|
schema: googleLanguageModelOptions
|
|
1237
1238
|
});
|
|
1238
1239
|
if (googleOptions == null && providerOptionsName !== "google") {
|
|
1239
|
-
googleOptions = await
|
|
1240
|
+
googleOptions = await parseProviderOptions({
|
|
1240
1241
|
provider: "google",
|
|
1241
1242
|
providerOptions,
|
|
1242
1243
|
schema: googleLanguageModelOptions
|
|
@@ -1257,6 +1258,10 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1257
1258
|
message: `'streamFunctionCallArguments' is only supported on the Vertex AI API and will be ignored with the current Google provider (${this.config.provider}). See https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc`
|
|
1258
1259
|
});
|
|
1259
1260
|
}
|
|
1261
|
+
let sanitizedServiceTier = googleOptions == null ? void 0 : googleOptions.serviceTier;
|
|
1262
|
+
if ((googleOptions == null ? void 0 : googleOptions.serviceTier) && isVertexProvider) {
|
|
1263
|
+
sanitizedServiceTier = VertexServiceTierMap[googleOptions.serviceTier];
|
|
1264
|
+
}
|
|
1260
1265
|
const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
|
|
1261
1266
|
const supportsFunctionResponseParts = this.modelId.startsWith("gemini-3");
|
|
1262
1267
|
const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(
|
|
@@ -1333,7 +1338,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1333
1338
|
toolConfig,
|
|
1334
1339
|
cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
|
|
1335
1340
|
labels: googleOptions == null ? void 0 : googleOptions.labels,
|
|
1336
|
-
serviceTier:
|
|
1341
|
+
serviceTier: sanitizedServiceTier
|
|
1337
1342
|
},
|
|
1338
1343
|
warnings: [...warnings, ...toolWarnings],
|
|
1339
1344
|
providerOptionsName
|
|
@@ -1342,22 +1347,22 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1342
1347
|
async doGenerate(options) {
|
|
1343
1348
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
1344
1349
|
const { args, warnings, providerOptionsName } = await this.getArgs(options);
|
|
1345
|
-
const mergedHeaders =
|
|
1346
|
-
await
|
|
1350
|
+
const mergedHeaders = combineHeaders(
|
|
1351
|
+
await resolve(this.config.headers),
|
|
1347
1352
|
options.headers
|
|
1348
1353
|
);
|
|
1349
1354
|
const {
|
|
1350
1355
|
responseHeaders,
|
|
1351
1356
|
value: response,
|
|
1352
1357
|
rawValue: rawResponse
|
|
1353
|
-
} = await
|
|
1358
|
+
} = await postJsonToApi({
|
|
1354
1359
|
url: `${this.config.baseURL}/${getModelPath(
|
|
1355
1360
|
this.modelId
|
|
1356
1361
|
)}:generateContent`,
|
|
1357
1362
|
headers: mergedHeaders,
|
|
1358
1363
|
body: args,
|
|
1359
1364
|
failedResponseHandler: googleFailedResponseHandler,
|
|
1360
|
-
successfulResponseHandler:
|
|
1365
|
+
successfulResponseHandler: createJsonResponseHandler(responseSchema),
|
|
1361
1366
|
abortSignal: options.abortSignal,
|
|
1362
1367
|
fetch: this.config.fetch
|
|
1363
1368
|
});
|
|
@@ -1524,18 +1529,18 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1524
1529
|
options,
|
|
1525
1530
|
{ isStreaming: true }
|
|
1526
1531
|
);
|
|
1527
|
-
const headers =
|
|
1528
|
-
await
|
|
1532
|
+
const headers = combineHeaders(
|
|
1533
|
+
await resolve(this.config.headers),
|
|
1529
1534
|
options.headers
|
|
1530
1535
|
);
|
|
1531
|
-
const { responseHeaders, value: response } = await
|
|
1536
|
+
const { responseHeaders, value: response } = await postJsonToApi({
|
|
1532
1537
|
url: `${this.config.baseURL}/${getModelPath(
|
|
1533
1538
|
this.modelId
|
|
1534
1539
|
)}:streamGenerateContent?alt=sse`,
|
|
1535
1540
|
headers,
|
|
1536
1541
|
body: args,
|
|
1537
1542
|
failedResponseHandler: googleFailedResponseHandler,
|
|
1538
|
-
successfulResponseHandler:
|
|
1543
|
+
successfulResponseHandler: createEventSourceResponseHandler(chunkSchema),
|
|
1539
1544
|
abortSignal: options.abortSignal,
|
|
1540
1545
|
fetch: this.config.fetch
|
|
1541
1546
|
});
|
|
@@ -1931,7 +1936,7 @@ function resolveThinkingConfig({
|
|
|
1931
1936
|
modelId,
|
|
1932
1937
|
warnings
|
|
1933
1938
|
}) {
|
|
1934
|
-
if (!
|
|
1939
|
+
if (!isCustomReasoning(reasoning)) {
|
|
1935
1940
|
return void 0;
|
|
1936
1941
|
}
|
|
1937
1942
|
if (isGemini3Model(modelId) && !modelId.includes("gemini-3-pro-image")) {
|
|
@@ -1946,7 +1951,7 @@ function resolveGemini3ThinkingConfig({
|
|
|
1946
1951
|
if (reasoning === "none") {
|
|
1947
1952
|
return { thinkingLevel: "minimal" };
|
|
1948
1953
|
}
|
|
1949
|
-
const thinkingLevel =
|
|
1954
|
+
const thinkingLevel = mapReasoningToProviderEffort({
|
|
1950
1955
|
reasoning,
|
|
1951
1956
|
effortMap: {
|
|
1952
1957
|
minimal: "minimal",
|
|
@@ -1970,7 +1975,7 @@ function resolveGemini25ThinkingConfig({
|
|
|
1970
1975
|
if (reasoning === "none") {
|
|
1971
1976
|
return { thinkingBudget: 0 };
|
|
1972
1977
|
}
|
|
1973
|
-
const thinkingBudget =
|
|
1978
|
+
const thinkingBudget = mapReasoningToProviderBudget({
|
|
1974
1979
|
reasoning,
|
|
1975
1980
|
maxOutputTokens: getMaxOutputTokensForGemini25Model(),
|
|
1976
1981
|
maxReasoningBudget: getMaxThinkingTokensForGemini25Model(modelId),
|
|
@@ -2076,270 +2081,286 @@ function extractSources({
|
|
|
2076
2081
|
}
|
|
2077
2082
|
return sources.length > 0 ? sources : void 0;
|
|
2078
2083
|
}
|
|
2079
|
-
var getGroundingMetadataSchema = () =>
|
|
2080
|
-
webSearchQueries:
|
|
2081
|
-
imageSearchQueries:
|
|
2082
|
-
retrievalQueries:
|
|
2083
|
-
searchEntryPoint:
|
|
2084
|
-
groundingChunks:
|
|
2085
|
-
|
|
2086
|
-
web:
|
|
2087
|
-
image:
|
|
2088
|
-
sourceUri:
|
|
2089
|
-
imageUri:
|
|
2090
|
-
title:
|
|
2091
|
-
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()
|
|
2092
2097
|
}).nullish(),
|
|
2093
|
-
retrievedContext:
|
|
2094
|
-
uri:
|
|
2095
|
-
title:
|
|
2096
|
-
text:
|
|
2097
|
-
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()
|
|
2098
2103
|
}).nullish(),
|
|
2099
|
-
maps:
|
|
2100
|
-
uri:
|
|
2101
|
-
title:
|
|
2102
|
-
text:
|
|
2103
|
-
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()
|
|
2104
2109
|
}).nullish()
|
|
2105
2110
|
})
|
|
2106
2111
|
).nullish(),
|
|
2107
|
-
groundingSupports:
|
|
2108
|
-
|
|
2109
|
-
segment:
|
|
2110
|
-
startIndex:
|
|
2111
|
-
endIndex:
|
|
2112
|
-
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()
|
|
2113
2118
|
}).nullish(),
|
|
2114
|
-
segment_text:
|
|
2115
|
-
groundingChunkIndices:
|
|
2116
|
-
supportChunkIndices:
|
|
2117
|
-
confidenceScores:
|
|
2118
|
-
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()
|
|
2119
2124
|
})
|
|
2120
2125
|
).nullish(),
|
|
2121
|
-
retrievalMetadata:
|
|
2122
|
-
|
|
2123
|
-
webDynamicRetrievalScore:
|
|
2126
|
+
retrievalMetadata: z3.union([
|
|
2127
|
+
z3.object({
|
|
2128
|
+
webDynamicRetrievalScore: z3.number()
|
|
2124
2129
|
}),
|
|
2125
|
-
|
|
2130
|
+
z3.object({})
|
|
2126
2131
|
]).nullish()
|
|
2127
2132
|
});
|
|
2128
|
-
var partialArgSchema =
|
|
2129
|
-
jsonPath:
|
|
2130
|
-
stringValue:
|
|
2131
|
-
numberValue:
|
|
2132
|
-
boolValue:
|
|
2133
|
-
nullValue:
|
|
2134
|
-
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()
|
|
2135
2140
|
});
|
|
2136
|
-
var getContentSchema = () =>
|
|
2137
|
-
parts:
|
|
2138
|
-
|
|
2141
|
+
var getContentSchema = () => z3.object({
|
|
2142
|
+
parts: z3.array(
|
|
2143
|
+
z3.union([
|
|
2139
2144
|
// note: order matters since text can be fully empty
|
|
2140
|
-
|
|
2141
|
-
functionCall:
|
|
2142
|
-
name:
|
|
2143
|
-
args:
|
|
2144
|
-
partialArgs:
|
|
2145
|
-
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()
|
|
2146
2151
|
}),
|
|
2147
|
-
thoughtSignature:
|
|
2152
|
+
thoughtSignature: z3.string().nullish()
|
|
2148
2153
|
}),
|
|
2149
|
-
|
|
2150
|
-
inlineData:
|
|
2151
|
-
mimeType:
|
|
2152
|
-
data:
|
|
2154
|
+
z3.object({
|
|
2155
|
+
inlineData: z3.object({
|
|
2156
|
+
mimeType: z3.string(),
|
|
2157
|
+
data: z3.string()
|
|
2153
2158
|
}),
|
|
2154
|
-
thought:
|
|
2155
|
-
thoughtSignature:
|
|
2159
|
+
thought: z3.boolean().nullish(),
|
|
2160
|
+
thoughtSignature: z3.string().nullish()
|
|
2156
2161
|
}),
|
|
2157
|
-
|
|
2158
|
-
toolCall:
|
|
2159
|
-
toolType:
|
|
2160
|
-
args:
|
|
2161
|
-
id:
|
|
2162
|
+
z3.object({
|
|
2163
|
+
toolCall: z3.object({
|
|
2164
|
+
toolType: z3.string(),
|
|
2165
|
+
args: z3.unknown().nullish(),
|
|
2166
|
+
id: z3.string()
|
|
2162
2167
|
}),
|
|
2163
|
-
thoughtSignature:
|
|
2168
|
+
thoughtSignature: z3.string().nullish()
|
|
2164
2169
|
}),
|
|
2165
|
-
|
|
2166
|
-
toolResponse:
|
|
2167
|
-
toolType:
|
|
2168
|
-
response:
|
|
2169
|
-
id:
|
|
2170
|
+
z3.object({
|
|
2171
|
+
toolResponse: z3.object({
|
|
2172
|
+
toolType: z3.string(),
|
|
2173
|
+
response: z3.unknown().nullish(),
|
|
2174
|
+
id: z3.string()
|
|
2170
2175
|
}),
|
|
2171
|
-
thoughtSignature:
|
|
2176
|
+
thoughtSignature: z3.string().nullish()
|
|
2172
2177
|
}),
|
|
2173
|
-
|
|
2174
|
-
executableCode:
|
|
2175
|
-
language:
|
|
2176
|
-
code:
|
|
2178
|
+
z3.object({
|
|
2179
|
+
executableCode: z3.object({
|
|
2180
|
+
language: z3.string(),
|
|
2181
|
+
code: z3.string()
|
|
2177
2182
|
}).nullish(),
|
|
2178
|
-
codeExecutionResult:
|
|
2179
|
-
outcome:
|
|
2180
|
-
output:
|
|
2183
|
+
codeExecutionResult: z3.object({
|
|
2184
|
+
outcome: z3.string(),
|
|
2185
|
+
output: z3.string().nullish()
|
|
2181
2186
|
}).nullish(),
|
|
2182
|
-
text:
|
|
2183
|
-
thought:
|
|
2184
|
-
thoughtSignature:
|
|
2187
|
+
text: z3.string().nullish(),
|
|
2188
|
+
thought: z3.boolean().nullish(),
|
|
2189
|
+
thoughtSignature: z3.string().nullish()
|
|
2185
2190
|
})
|
|
2186
2191
|
])
|
|
2187
2192
|
).nullish()
|
|
2188
2193
|
});
|
|
2189
|
-
var getSafetyRatingSchema = () =>
|
|
2190
|
-
category:
|
|
2191
|
-
probability:
|
|
2192
|
-
probabilityScore:
|
|
2193
|
-
severity:
|
|
2194
|
-
severityScore:
|
|
2195
|
-
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()
|
|
2196
2201
|
});
|
|
2197
|
-
var tokenDetailsSchema =
|
|
2198
|
-
|
|
2199
|
-
modality:
|
|
2200
|
-
tokenCount:
|
|
2202
|
+
var tokenDetailsSchema = z3.array(
|
|
2203
|
+
z3.object({
|
|
2204
|
+
modality: z3.string(),
|
|
2205
|
+
tokenCount: z3.number()
|
|
2201
2206
|
})
|
|
2202
2207
|
).nullish();
|
|
2203
|
-
var usageSchema =
|
|
2204
|
-
cachedContentTokenCount:
|
|
2205
|
-
thoughtsTokenCount:
|
|
2206
|
-
promptTokenCount:
|
|
2207
|
-
candidatesTokenCount:
|
|
2208
|
-
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(),
|
|
2209
2214
|
// https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType
|
|
2210
|
-
trafficType:
|
|
2215
|
+
trafficType: z3.string().nullish(),
|
|
2211
2216
|
// https://ai.google.dev/api/generate-content#Modality
|
|
2212
2217
|
promptTokensDetails: tokenDetailsSchema,
|
|
2213
2218
|
candidatesTokensDetails: tokenDetailsSchema
|
|
2214
2219
|
});
|
|
2215
|
-
var getUrlContextMetadataSchema = () =>
|
|
2216
|
-
urlMetadata:
|
|
2217
|
-
|
|
2218
|
-
retrievedUrl:
|
|
2219
|
-
urlRetrievalStatus:
|
|
2220
|
+
var getUrlContextMetadataSchema = () => z3.object({
|
|
2221
|
+
urlMetadata: z3.array(
|
|
2222
|
+
z3.object({
|
|
2223
|
+
retrievedUrl: z3.string(),
|
|
2224
|
+
urlRetrievalStatus: z3.string()
|
|
2220
2225
|
})
|
|
2221
2226
|
).nullish()
|
|
2222
2227
|
});
|
|
2223
|
-
var responseSchema = (
|
|
2224
|
-
() => (
|
|
2225
|
-
|
|
2226
|
-
candidates:
|
|
2227
|
-
|
|
2228
|
-
content: getContentSchema().nullish().or(
|
|
2229
|
-
finishReason:
|
|
2230
|
-
finishMessage:
|
|
2231
|
-
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(),
|
|
2232
2237
|
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
|
2233
2238
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2234
2239
|
})
|
|
2235
2240
|
),
|
|
2236
2241
|
usageMetadata: usageSchema.nullish(),
|
|
2237
|
-
promptFeedback:
|
|
2238
|
-
blockReason:
|
|
2239
|
-
safetyRatings:
|
|
2242
|
+
promptFeedback: z3.object({
|
|
2243
|
+
blockReason: z3.string().nullish(),
|
|
2244
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
|
|
2240
2245
|
}).nullish(),
|
|
2241
|
-
serviceTier:
|
|
2246
|
+
serviceTier: z3.string().nullish()
|
|
2242
2247
|
})
|
|
2243
2248
|
)
|
|
2244
2249
|
);
|
|
2245
|
-
var chunkSchema = (
|
|
2246
|
-
() => (
|
|
2247
|
-
|
|
2248
|
-
candidates:
|
|
2249
|
-
|
|
2250
|
+
var chunkSchema = lazySchema3(
|
|
2251
|
+
() => zodSchema3(
|
|
2252
|
+
z3.object({
|
|
2253
|
+
candidates: z3.array(
|
|
2254
|
+
z3.object({
|
|
2250
2255
|
content: getContentSchema().nullish(),
|
|
2251
|
-
finishReason:
|
|
2252
|
-
finishMessage:
|
|
2253
|
-
safetyRatings:
|
|
2256
|
+
finishReason: z3.string().nullish(),
|
|
2257
|
+
finishMessage: z3.string().nullish(),
|
|
2258
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
|
|
2254
2259
|
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
|
2255
2260
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2256
2261
|
})
|
|
2257
2262
|
).nullish(),
|
|
2258
2263
|
usageMetadata: usageSchema.nullish(),
|
|
2259
|
-
promptFeedback:
|
|
2260
|
-
blockReason:
|
|
2261
|
-
safetyRatings:
|
|
2264
|
+
promptFeedback: z3.object({
|
|
2265
|
+
blockReason: z3.string().nullish(),
|
|
2266
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
|
|
2262
2267
|
}).nullish(),
|
|
2263
|
-
serviceTier:
|
|
2268
|
+
serviceTier: z3.string().nullish()
|
|
2264
2269
|
})
|
|
2265
2270
|
)
|
|
2266
2271
|
);
|
|
2267
2272
|
|
|
2268
2273
|
// src/tool/code-execution.ts
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
var codeExecution =
|
|
2274
|
+
import { createProviderToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
|
|
2275
|
+
import { z as z4 } from "zod/v4";
|
|
2276
|
+
var codeExecution = createProviderToolFactoryWithOutputSchema({
|
|
2272
2277
|
id: "google.code_execution",
|
|
2273
|
-
inputSchema:
|
|
2274
|
-
language:
|
|
2275
|
-
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.")
|
|
2276
2281
|
}),
|
|
2277
|
-
outputSchema:
|
|
2278
|
-
outcome:
|
|
2279
|
-
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.")
|
|
2280
2285
|
})
|
|
2281
2286
|
});
|
|
2282
2287
|
|
|
2283
2288
|
// src/tool/enterprise-web-search.ts
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
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({
|
|
2287
2296
|
id: "google.enterprise_web_search",
|
|
2288
|
-
inputSchema: (
|
|
2297
|
+
inputSchema: lazySchema4(() => zodSchema4(z5.object({})))
|
|
2289
2298
|
});
|
|
2290
2299
|
|
|
2291
2300
|
// src/tool/file-search.ts
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
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({
|
|
2295
2308
|
/** The names of the file_search_stores to retrieve from.
|
|
2296
2309
|
* Example: `fileSearchStores/my-file-search-store-123`
|
|
2297
2310
|
*/
|
|
2298
|
-
fileSearchStoreNames:
|
|
2311
|
+
fileSearchStoreNames: z6.array(z6.string()).describe(
|
|
2299
2312
|
"The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
|
|
2300
2313
|
),
|
|
2301
2314
|
/** The number of file search retrieval chunks to retrieve. */
|
|
2302
|
-
topK:
|
|
2315
|
+
topK: z6.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
|
|
2303
2316
|
/** Metadata filter to apply to the file search retrieval documents.
|
|
2304
2317
|
* See https://google.aip.dev/160 for the syntax of the filter expression.
|
|
2305
2318
|
*/
|
|
2306
|
-
metadataFilter:
|
|
2319
|
+
metadataFilter: z6.string().describe(
|
|
2307
2320
|
"Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
|
|
2308
2321
|
).optional()
|
|
2309
2322
|
}).passthrough();
|
|
2310
|
-
var fileSearchArgsSchema = (
|
|
2311
|
-
() => (
|
|
2323
|
+
var fileSearchArgsSchema = lazySchema5(
|
|
2324
|
+
() => zodSchema5(fileSearchArgsBaseSchema)
|
|
2312
2325
|
);
|
|
2313
|
-
var fileSearch = (
|
|
2326
|
+
var fileSearch = createProviderToolFactory2({
|
|
2314
2327
|
id: "google.file_search",
|
|
2315
2328
|
inputSchema: fileSearchArgsSchema
|
|
2316
2329
|
});
|
|
2317
2330
|
|
|
2318
2331
|
// src/tool/google-maps.ts
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
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({
|
|
2322
2339
|
id: "google.google_maps",
|
|
2323
|
-
inputSchema: (
|
|
2340
|
+
inputSchema: lazySchema6(() => zodSchema6(z7.object({})))
|
|
2324
2341
|
});
|
|
2325
2342
|
|
|
2326
2343
|
// src/tool/google-search.ts
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
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()
|
|
2333
2354
|
}).optional(),
|
|
2334
|
-
timeRangeFilter:
|
|
2335
|
-
startTime:
|
|
2336
|
-
endTime:
|
|
2355
|
+
timeRangeFilter: z8.object({
|
|
2356
|
+
startTime: z8.string(),
|
|
2357
|
+
endTime: z8.string()
|
|
2337
2358
|
}).optional()
|
|
2338
2359
|
}).passthrough();
|
|
2339
|
-
var googleSearchToolArgsSchema = (
|
|
2340
|
-
() => (
|
|
2360
|
+
var googleSearchToolArgsSchema = lazySchema7(
|
|
2361
|
+
() => zodSchema7(googleSearchToolArgsBaseSchema)
|
|
2341
2362
|
);
|
|
2342
|
-
var googleSearch = (
|
|
2363
|
+
var googleSearch = createProviderToolFactory4(
|
|
2343
2364
|
{
|
|
2344
2365
|
id: "google.google_search",
|
|
2345
2366
|
inputSchema: googleSearchToolArgsSchema
|
|
@@ -2347,21 +2368,25 @@ var googleSearch = (0, import_provider_utils9.createProviderToolFactory)(
|
|
|
2347
2368
|
);
|
|
2348
2369
|
|
|
2349
2370
|
// src/tool/url-context.ts
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
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({
|
|
2353
2378
|
id: "google.url_context",
|
|
2354
|
-
inputSchema: (
|
|
2379
|
+
inputSchema: lazySchema8(() => zodSchema8(z9.object({})))
|
|
2355
2380
|
});
|
|
2356
2381
|
|
|
2357
2382
|
// src/tool/vertex-rag-store.ts
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
var vertexRagStore = (
|
|
2383
|
+
import { createProviderToolFactory as createProviderToolFactory6 } from "@ai-sdk/provider-utils";
|
|
2384
|
+
import { z as z10 } from "zod/v4";
|
|
2385
|
+
var vertexRagStore = createProviderToolFactory6({
|
|
2361
2386
|
id: "google.vertex_rag_store",
|
|
2362
|
-
inputSchema:
|
|
2363
|
-
ragCorpus:
|
|
2364
|
-
topK:
|
|
2387
|
+
inputSchema: z10.object({
|
|
2388
|
+
ragCorpus: z10.string(),
|
|
2389
|
+
topK: z10.number().optional()
|
|
2365
2390
|
})
|
|
2366
2391
|
});
|
|
2367
2392
|
|
|
@@ -2424,11 +2449,10 @@ var googleTools = {
|
|
|
2424
2449
|
*/
|
|
2425
2450
|
vertexRagStore
|
|
2426
2451
|
};
|
|
2427
|
-
|
|
2428
|
-
0 && (module.exports = {
|
|
2452
|
+
export {
|
|
2429
2453
|
GoogleGenerativeAILanguageModel,
|
|
2430
2454
|
getGroundingMetadataSchema,
|
|
2431
2455
|
getUrlContextMetadataSchema,
|
|
2432
2456
|
googleTools
|
|
2433
|
-
}
|
|
2457
|
+
};
|
|
2434
2458
|
//# sourceMappingURL=index.js.map
|