@ai-sdk/google 3.0.0-beta.15 → 3.0.0-beta.17
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 +15 -0
- package/dist/index.d.mts +139 -138
- package/dist/index.d.ts +139 -138
- package/dist/index.js +312 -268
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +319 -251
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +138 -10
- package/dist/internal/index.d.ts +138 -10
- package/dist/internal/index.js +246 -221
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +249 -208
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/internal/index.js
CHANGED
@@ -31,14 +31,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
31
31
|
var internal_exports = {};
|
32
32
|
__export(internal_exports, {
|
33
33
|
GoogleGenerativeAILanguageModel: () => GoogleGenerativeAILanguageModel,
|
34
|
-
|
35
|
-
|
34
|
+
getGroundingMetadataSchema: () => getGroundingMetadataSchema,
|
35
|
+
getUrlContextMetadataSchema: () => getUrlContextMetadataSchema,
|
36
|
+
googleTools: () => googleTools
|
36
37
|
});
|
37
38
|
module.exports = __toCommonJS(internal_exports);
|
38
39
|
|
39
40
|
// src/google-generative-ai-language-model.ts
|
40
|
-
var
|
41
|
-
var
|
41
|
+
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
42
|
+
var z3 = __toESM(require("zod/v4"));
|
42
43
|
|
43
44
|
// src/convert-json-schema-to-openapi-schema.ts
|
44
45
|
function convertJSONSchemaToOpenAPISchema(jsonSchema) {
|
@@ -312,54 +313,71 @@ function getModelPath(modelId) {
|
|
312
313
|
// src/google-error.ts
|
313
314
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
314
315
|
var z = __toESM(require("zod/v4"));
|
315
|
-
var googleErrorDataSchema =
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
316
|
+
var googleErrorDataSchema = (0, import_provider_utils2.lazySchema)(
|
317
|
+
() => (0, import_provider_utils2.zodSchema)(
|
318
|
+
z.object({
|
319
|
+
error: z.object({
|
320
|
+
code: z.number().nullable(),
|
321
|
+
message: z.string(),
|
322
|
+
status: z.string()
|
323
|
+
})
|
324
|
+
})
|
325
|
+
)
|
326
|
+
);
|
322
327
|
var googleFailedResponseHandler = (0, import_provider_utils2.createJsonErrorResponseHandler)({
|
323
328
|
errorSchema: googleErrorDataSchema,
|
324
329
|
errorToMessage: (data) => data.error.message
|
325
330
|
});
|
326
331
|
|
327
332
|
// src/google-generative-ai-options.ts
|
333
|
+
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
328
334
|
var z2 = __toESM(require("zod/v4"));
|
329
|
-
var googleGenerativeAIProviderOptions =
|
330
|
-
|
331
|
-
thinkingConfig: z2.object({
|
332
|
-
thinkingBudget: z2.number().optional(),
|
333
|
-
includeThoughts: z2.boolean().optional()
|
334
|
-
}).optional(),
|
335
|
-
/**
|
336
|
-
Optional.
|
337
|
-
The name of the cached content used as context to serve the prediction.
|
338
|
-
Format: cachedContents/{cachedContent}
|
339
|
-
*/
|
340
|
-
cachedContent: z2.string().optional(),
|
341
|
-
/**
|
342
|
-
* Optional. Enable structured output. Default is true.
|
343
|
-
*
|
344
|
-
* This is useful when the JSON Schema contains elements that are
|
345
|
-
* not supported by the OpenAPI schema version that
|
346
|
-
* Google Generative AI uses. You can use this to disable
|
347
|
-
* structured outputs if you need to.
|
348
|
-
*/
|
349
|
-
structuredOutputs: z2.boolean().optional(),
|
350
|
-
/**
|
351
|
-
Optional. A list of unique safety settings for blocking unsafe content.
|
352
|
-
*/
|
353
|
-
safetySettings: z2.array(
|
335
|
+
var googleGenerativeAIProviderOptions = (0, import_provider_utils3.lazySchema)(
|
336
|
+
() => (0, import_provider_utils3.zodSchema)(
|
354
337
|
z2.object({
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
338
|
+
responseModalities: z2.array(z2.enum(["TEXT", "IMAGE"])).optional(),
|
339
|
+
thinkingConfig: z2.object({
|
340
|
+
thinkingBudget: z2.number().optional(),
|
341
|
+
includeThoughts: z2.boolean().optional()
|
342
|
+
}).optional(),
|
343
|
+
/**
|
344
|
+
* Optional.
|
345
|
+
* The name of the cached content used as context to serve the prediction.
|
346
|
+
* Format: cachedContents/{cachedContent}
|
347
|
+
*/
|
348
|
+
cachedContent: z2.string().optional(),
|
349
|
+
/**
|
350
|
+
* Optional. Enable structured output. Default is true.
|
351
|
+
*
|
352
|
+
* This is useful when the JSON Schema contains elements that are
|
353
|
+
* not supported by the OpenAPI schema version that
|
354
|
+
* Google Generative AI uses. You can use this to disable
|
355
|
+
* structured outputs if you need to.
|
356
|
+
*/
|
357
|
+
structuredOutputs: z2.boolean().optional(),
|
358
|
+
/**
|
359
|
+
* Optional. A list of unique safety settings for blocking unsafe content.
|
360
|
+
*/
|
361
|
+
safetySettings: z2.array(
|
362
|
+
z2.object({
|
363
|
+
category: z2.enum([
|
364
|
+
"HARM_CATEGORY_UNSPECIFIED",
|
365
|
+
"HARM_CATEGORY_HATE_SPEECH",
|
366
|
+
"HARM_CATEGORY_DANGEROUS_CONTENT",
|
367
|
+
"HARM_CATEGORY_HARASSMENT",
|
368
|
+
"HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
369
|
+
"HARM_CATEGORY_CIVIC_INTEGRITY"
|
370
|
+
]),
|
371
|
+
threshold: z2.enum([
|
372
|
+
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
373
|
+
"BLOCK_LOW_AND_ABOVE",
|
374
|
+
"BLOCK_MEDIUM_AND_ABOVE",
|
375
|
+
"BLOCK_ONLY_HIGH",
|
376
|
+
"BLOCK_NONE",
|
377
|
+
"OFF"
|
378
|
+
])
|
379
|
+
})
|
380
|
+
).optional(),
|
363
381
|
threshold: z2.enum([
|
364
382
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
365
383
|
"BLOCK_LOW_AND_ABOVE",
|
@@ -367,41 +385,33 @@ var googleGenerativeAIProviderOptions = z2.object({
|
|
367
385
|
"BLOCK_ONLY_HIGH",
|
368
386
|
"BLOCK_NONE",
|
369
387
|
"OFF"
|
370
|
-
])
|
388
|
+
]).optional(),
|
389
|
+
/**
|
390
|
+
* Optional. Enables timestamp understanding for audio-only files.
|
391
|
+
*
|
392
|
+
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
|
393
|
+
*/
|
394
|
+
audioTimestamp: z2.boolean().optional(),
|
395
|
+
/**
|
396
|
+
* Optional. Defines labels used in billing reports. Available on Vertex AI only.
|
397
|
+
*
|
398
|
+
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
|
399
|
+
*/
|
400
|
+
labels: z2.record(z2.string(), z2.string()).optional(),
|
401
|
+
/**
|
402
|
+
* Optional. If specified, the media resolution specified will be used.
|
403
|
+
*
|
404
|
+
* https://ai.google.dev/api/generate-content#MediaResolution
|
405
|
+
*/
|
406
|
+
mediaResolution: z2.enum([
|
407
|
+
"MEDIA_RESOLUTION_UNSPECIFIED",
|
408
|
+
"MEDIA_RESOLUTION_LOW",
|
409
|
+
"MEDIA_RESOLUTION_MEDIUM",
|
410
|
+
"MEDIA_RESOLUTION_HIGH"
|
411
|
+
]).optional()
|
371
412
|
})
|
372
|
-
)
|
373
|
-
|
374
|
-
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
375
|
-
"BLOCK_LOW_AND_ABOVE",
|
376
|
-
"BLOCK_MEDIUM_AND_ABOVE",
|
377
|
-
"BLOCK_ONLY_HIGH",
|
378
|
-
"BLOCK_NONE",
|
379
|
-
"OFF"
|
380
|
-
]).optional(),
|
381
|
-
/**
|
382
|
-
* Optional. Enables timestamp understanding for audio-only files.
|
383
|
-
*
|
384
|
-
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
|
385
|
-
*/
|
386
|
-
audioTimestamp: z2.boolean().optional(),
|
387
|
-
/**
|
388
|
-
* Optional. Defines labels used in billing reports. Available on Vertex AI only.
|
389
|
-
*
|
390
|
-
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
|
391
|
-
*/
|
392
|
-
labels: z2.record(z2.string(), z2.string()).optional(),
|
393
|
-
/**
|
394
|
-
* Optional. If specified, the media resolution specified will be used.
|
395
|
-
*
|
396
|
-
* https://ai.google.dev/api/generate-content#MediaResolution
|
397
|
-
*/
|
398
|
-
mediaResolution: z2.enum([
|
399
|
-
"MEDIA_RESOLUTION_UNSPECIFIED",
|
400
|
-
"MEDIA_RESOLUTION_LOW",
|
401
|
-
"MEDIA_RESOLUTION_MEDIUM",
|
402
|
-
"MEDIA_RESOLUTION_HIGH"
|
403
|
-
]).optional()
|
404
|
-
});
|
413
|
+
)
|
414
|
+
);
|
405
415
|
|
406
416
|
// src/google-prepare-tools.ts
|
407
417
|
var import_provider2 = require("@ai-sdk/provider");
|
@@ -577,64 +587,6 @@ function mapGoogleGenerativeAIFinishReason({
|
|
577
587
|
}
|
578
588
|
}
|
579
589
|
|
580
|
-
// src/tool/google-search.ts
|
581
|
-
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
582
|
-
var z3 = __toESM(require("zod/v4"));
|
583
|
-
var groundingChunkSchema = z3.object({
|
584
|
-
web: z3.object({ uri: z3.string(), title: z3.string() }).nullish(),
|
585
|
-
retrievedContext: z3.object({ uri: z3.string(), title: z3.string() }).nullish()
|
586
|
-
});
|
587
|
-
var groundingMetadataSchema = z3.object({
|
588
|
-
webSearchQueries: z3.array(z3.string()).nullish(),
|
589
|
-
retrievalQueries: z3.array(z3.string()).nullish(),
|
590
|
-
searchEntryPoint: z3.object({ renderedContent: z3.string() }).nullish(),
|
591
|
-
groundingChunks: z3.array(groundingChunkSchema).nullish(),
|
592
|
-
groundingSupports: z3.array(
|
593
|
-
z3.object({
|
594
|
-
segment: z3.object({
|
595
|
-
startIndex: z3.number().nullish(),
|
596
|
-
endIndex: z3.number().nullish(),
|
597
|
-
text: z3.string().nullish()
|
598
|
-
}),
|
599
|
-
segment_text: z3.string().nullish(),
|
600
|
-
groundingChunkIndices: z3.array(z3.number()).nullish(),
|
601
|
-
supportChunkIndices: z3.array(z3.number()).nullish(),
|
602
|
-
confidenceScores: z3.array(z3.number()).nullish(),
|
603
|
-
confidenceScore: z3.array(z3.number()).nullish()
|
604
|
-
})
|
605
|
-
).nullish(),
|
606
|
-
retrievalMetadata: z3.union([
|
607
|
-
z3.object({
|
608
|
-
webDynamicRetrievalScore: z3.number()
|
609
|
-
}),
|
610
|
-
z3.object({})
|
611
|
-
]).nullish()
|
612
|
-
});
|
613
|
-
var googleSearch = (0, import_provider_utils3.createProviderDefinedToolFactory)({
|
614
|
-
id: "google.google_search",
|
615
|
-
name: "google_search",
|
616
|
-
inputSchema: z3.object({
|
617
|
-
mode: z3.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
618
|
-
dynamicThreshold: z3.number().default(1)
|
619
|
-
})
|
620
|
-
});
|
621
|
-
|
622
|
-
// src/tool/url-context.ts
|
623
|
-
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
624
|
-
var z4 = __toESM(require("zod/v4"));
|
625
|
-
var urlMetadataSchema = z4.object({
|
626
|
-
retrievedUrl: z4.string(),
|
627
|
-
urlRetrievalStatus: z4.string()
|
628
|
-
});
|
629
|
-
var urlContextMetadataSchema = z4.object({
|
630
|
-
urlMetadata: z4.array(urlMetadataSchema)
|
631
|
-
});
|
632
|
-
var urlContext = (0, import_provider_utils4.createProviderDefinedToolFactory)({
|
633
|
-
id: "google.url_context",
|
634
|
-
name: "url_context",
|
635
|
-
inputSchema: z4.object({})
|
636
|
-
});
|
637
|
-
|
638
590
|
// src/google-generative-ai-language-model.ts
|
639
591
|
var GoogleGenerativeAILanguageModel = class {
|
640
592
|
constructor(modelId, config) {
|
@@ -642,7 +594,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
642
594
|
var _a;
|
643
595
|
this.modelId = modelId;
|
644
596
|
this.config = config;
|
645
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
597
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils4.generateId;
|
646
598
|
}
|
647
599
|
get provider() {
|
648
600
|
return this.config.provider;
|
@@ -668,7 +620,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
668
620
|
}) {
|
669
621
|
var _a, _b;
|
670
622
|
const warnings = [];
|
671
|
-
const googleOptions = await (0,
|
623
|
+
const googleOptions = await (0, import_provider_utils4.parseProviderOptions)({
|
672
624
|
provider: "google",
|
673
625
|
providerOptions,
|
674
626
|
schema: googleGenerativeAIProviderOptions
|
@@ -736,22 +688,22 @@ var GoogleGenerativeAILanguageModel = class {
|
|
736
688
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
737
689
|
const { args, warnings } = await this.getArgs(options);
|
738
690
|
const body = JSON.stringify(args);
|
739
|
-
const mergedHeaders = (0,
|
740
|
-
await (0,
|
691
|
+
const mergedHeaders = (0, import_provider_utils4.combineHeaders)(
|
692
|
+
await (0, import_provider_utils4.resolve)(this.config.headers),
|
741
693
|
options.headers
|
742
694
|
);
|
743
695
|
const {
|
744
696
|
responseHeaders,
|
745
697
|
value: response,
|
746
698
|
rawValue: rawResponse
|
747
|
-
} = await (0,
|
699
|
+
} = await (0, import_provider_utils4.postJsonToApi)({
|
748
700
|
url: `${this.config.baseURL}/${getModelPath(
|
749
701
|
this.modelId
|
750
702
|
)}:generateContent`,
|
751
703
|
headers: mergedHeaders,
|
752
704
|
body: args,
|
753
705
|
failedResponseHandler: googleFailedResponseHandler,
|
754
|
-
successfulResponseHandler: (0,
|
706
|
+
successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(responseSchema),
|
755
707
|
abortSignal: options.abortSignal,
|
756
708
|
fetch: this.config.fetch
|
757
709
|
});
|
@@ -847,18 +799,18 @@ var GoogleGenerativeAILanguageModel = class {
|
|
847
799
|
async doStream(options) {
|
848
800
|
const { args, warnings } = await this.getArgs(options);
|
849
801
|
const body = JSON.stringify(args);
|
850
|
-
const headers = (0,
|
851
|
-
await (0,
|
802
|
+
const headers = (0, import_provider_utils4.combineHeaders)(
|
803
|
+
await (0, import_provider_utils4.resolve)(this.config.headers),
|
852
804
|
options.headers
|
853
805
|
);
|
854
|
-
const { responseHeaders, value: response } = await (0,
|
806
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils4.postJsonToApi)({
|
855
807
|
url: `${this.config.baseURL}/${getModelPath(
|
856
808
|
this.modelId
|
857
809
|
)}:streamGenerateContent?alt=sse`,
|
858
810
|
headers,
|
859
811
|
body: args,
|
860
812
|
failedResponseHandler: googleFailedResponseHandler,
|
861
|
-
successfulResponseHandler: (0,
|
813
|
+
successfulResponseHandler: (0, import_provider_utils4.createEventSourceResponseHandler)(chunkSchema),
|
862
814
|
abortSignal: options.abortSignal,
|
863
815
|
fetch: this.config.fetch
|
864
816
|
});
|
@@ -1130,103 +1082,175 @@ function extractSources({
|
|
1130
1082
|
title: chunk.web.title
|
1131
1083
|
}));
|
1132
1084
|
}
|
1133
|
-
var
|
1134
|
-
|
1135
|
-
|
1085
|
+
var getGroundingMetadataSchema = () => z3.object({
|
1086
|
+
webSearchQueries: z3.array(z3.string()).nullish(),
|
1087
|
+
retrievalQueries: z3.array(z3.string()).nullish(),
|
1088
|
+
searchEntryPoint: z3.object({ renderedContent: z3.string() }).nullish(),
|
1089
|
+
groundingChunks: z3.array(
|
1090
|
+
z3.object({
|
1091
|
+
web: z3.object({ uri: z3.string(), title: z3.string() }).nullish(),
|
1092
|
+
retrievedContext: z3.object({ uri: z3.string(), title: z3.string() }).nullish()
|
1093
|
+
})
|
1094
|
+
).nullish(),
|
1095
|
+
groundingSupports: z3.array(
|
1096
|
+
z3.object({
|
1097
|
+
segment: z3.object({
|
1098
|
+
startIndex: z3.number().nullish(),
|
1099
|
+
endIndex: z3.number().nullish(),
|
1100
|
+
text: z3.string().nullish()
|
1101
|
+
}),
|
1102
|
+
segment_text: z3.string().nullish(),
|
1103
|
+
groundingChunkIndices: z3.array(z3.number()).nullish(),
|
1104
|
+
supportChunkIndices: z3.array(z3.number()).nullish(),
|
1105
|
+
confidenceScores: z3.array(z3.number()).nullish(),
|
1106
|
+
confidenceScore: z3.array(z3.number()).nullish()
|
1107
|
+
})
|
1108
|
+
).nullish(),
|
1109
|
+
retrievalMetadata: z3.union([
|
1110
|
+
z3.object({
|
1111
|
+
webDynamicRetrievalScore: z3.number()
|
1112
|
+
}),
|
1113
|
+
z3.object({})
|
1114
|
+
]).nullish()
|
1115
|
+
});
|
1116
|
+
var getContentSchema = () => z3.object({
|
1117
|
+
parts: z3.array(
|
1118
|
+
z3.union([
|
1136
1119
|
// note: order matters since text can be fully empty
|
1137
|
-
|
1138
|
-
functionCall:
|
1139
|
-
name:
|
1140
|
-
args:
|
1120
|
+
z3.object({
|
1121
|
+
functionCall: z3.object({
|
1122
|
+
name: z3.string(),
|
1123
|
+
args: z3.unknown()
|
1141
1124
|
}),
|
1142
|
-
thoughtSignature:
|
1125
|
+
thoughtSignature: z3.string().nullish()
|
1143
1126
|
}),
|
1144
|
-
|
1145
|
-
inlineData:
|
1146
|
-
mimeType:
|
1147
|
-
data:
|
1127
|
+
z3.object({
|
1128
|
+
inlineData: z3.object({
|
1129
|
+
mimeType: z3.string(),
|
1130
|
+
data: z3.string()
|
1148
1131
|
})
|
1149
1132
|
}),
|
1150
|
-
|
1151
|
-
executableCode:
|
1152
|
-
language:
|
1153
|
-
code:
|
1133
|
+
z3.object({
|
1134
|
+
executableCode: z3.object({
|
1135
|
+
language: z3.string(),
|
1136
|
+
code: z3.string()
|
1154
1137
|
}).nullish(),
|
1155
|
-
codeExecutionResult:
|
1156
|
-
outcome:
|
1157
|
-
output:
|
1138
|
+
codeExecutionResult: z3.object({
|
1139
|
+
outcome: z3.string(),
|
1140
|
+
output: z3.string()
|
1158
1141
|
}).nullish(),
|
1159
|
-
text:
|
1160
|
-
thought:
|
1161
|
-
thoughtSignature:
|
1142
|
+
text: z3.string().nullish(),
|
1143
|
+
thought: z3.boolean().nullish(),
|
1144
|
+
thoughtSignature: z3.string().nullish()
|
1162
1145
|
})
|
1163
1146
|
])
|
1164
1147
|
).nullish()
|
1165
1148
|
});
|
1166
|
-
var
|
1167
|
-
category:
|
1168
|
-
probability:
|
1169
|
-
probabilityScore:
|
1170
|
-
severity:
|
1171
|
-
severityScore:
|
1172
|
-
blocked:
|
1149
|
+
var getSafetyRatingSchema = () => z3.object({
|
1150
|
+
category: z3.string().nullish(),
|
1151
|
+
probability: z3.string().nullish(),
|
1152
|
+
probabilityScore: z3.number().nullish(),
|
1153
|
+
severity: z3.string().nullish(),
|
1154
|
+
severityScore: z3.number().nullish(),
|
1155
|
+
blocked: z3.boolean().nullish()
|
1173
1156
|
});
|
1174
|
-
var usageSchema =
|
1175
|
-
cachedContentTokenCount:
|
1176
|
-
thoughtsTokenCount:
|
1177
|
-
promptTokenCount:
|
1178
|
-
candidatesTokenCount:
|
1179
|
-
totalTokenCount:
|
1157
|
+
var usageSchema = z3.object({
|
1158
|
+
cachedContentTokenCount: z3.number().nullish(),
|
1159
|
+
thoughtsTokenCount: z3.number().nullish(),
|
1160
|
+
promptTokenCount: z3.number().nullish(),
|
1161
|
+
candidatesTokenCount: z3.number().nullish(),
|
1162
|
+
totalTokenCount: z3.number().nullish()
|
1180
1163
|
});
|
1181
|
-
var
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
safetyRatings: z5.array(safetyRatingSchema).nullish(),
|
1187
|
-
groundingMetadata: groundingMetadataSchema.nullish(),
|
1188
|
-
urlContextMetadata: urlContextMetadataSchema.nullish()
|
1164
|
+
var getUrlContextMetadataSchema = () => z3.object({
|
1165
|
+
urlMetadata: z3.array(
|
1166
|
+
z3.object({
|
1167
|
+
retrievedUrl: z3.string(),
|
1168
|
+
urlRetrievalStatus: z3.string()
|
1189
1169
|
})
|
1190
|
-
)
|
1191
|
-
usageMetadata: usageSchema.nullish(),
|
1192
|
-
promptFeedback: z5.object({
|
1193
|
-
blockReason: z5.string().nullish(),
|
1194
|
-
safetyRatings: z5.array(safetyRatingSchema).nullish()
|
1195
|
-
}).nullish()
|
1170
|
+
)
|
1196
1171
|
});
|
1197
|
-
var
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1172
|
+
var responseSchema = (0, import_provider_utils4.lazySchema)(
|
1173
|
+
() => (0, import_provider_utils4.zodSchema)(
|
1174
|
+
z3.object({
|
1175
|
+
candidates: z3.array(
|
1176
|
+
z3.object({
|
1177
|
+
content: getContentSchema().nullish().or(z3.object({}).strict()),
|
1178
|
+
finishReason: z3.string().nullish(),
|
1179
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
|
1180
|
+
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
1181
|
+
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
1182
|
+
})
|
1183
|
+
),
|
1184
|
+
usageMetadata: usageSchema.nullish(),
|
1185
|
+
promptFeedback: z3.object({
|
1186
|
+
blockReason: z3.string().nullish(),
|
1187
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
|
1188
|
+
}).nullish()
|
1205
1189
|
})
|
1206
|
-
)
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1190
|
+
)
|
1191
|
+
);
|
1192
|
+
var chunkSchema = (0, import_provider_utils4.lazySchema)(
|
1193
|
+
() => (0, import_provider_utils4.zodSchema)(
|
1194
|
+
z3.object({
|
1195
|
+
candidates: z3.array(
|
1196
|
+
z3.object({
|
1197
|
+
content: getContentSchema().nullish(),
|
1198
|
+
finishReason: z3.string().nullish(),
|
1199
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
|
1200
|
+
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
1201
|
+
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
1202
|
+
})
|
1203
|
+
).nullish(),
|
1204
|
+
usageMetadata: usageSchema.nullish(),
|
1205
|
+
promptFeedback: z3.object({
|
1206
|
+
blockReason: z3.string().nullish(),
|
1207
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
|
1208
|
+
}).nullish()
|
1209
|
+
})
|
1210
|
+
)
|
1211
|
+
);
|
1213
1212
|
|
1214
1213
|
// src/tool/code-execution.ts
|
1215
|
-
var
|
1216
|
-
var
|
1217
|
-
var codeExecution = (0,
|
1214
|
+
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
1215
|
+
var z4 = __toESM(require("zod/v4"));
|
1216
|
+
var codeExecution = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
|
1218
1217
|
id: "google.code_execution",
|
1219
1218
|
name: "code_execution",
|
1220
|
-
inputSchema:
|
1221
|
-
language:
|
1222
|
-
code:
|
1219
|
+
inputSchema: z4.object({
|
1220
|
+
language: z4.string().describe("The programming language of the code."),
|
1221
|
+
code: z4.string().describe("The code to be executed.")
|
1223
1222
|
}),
|
1224
|
-
outputSchema:
|
1225
|
-
outcome:
|
1226
|
-
output:
|
1223
|
+
outputSchema: z4.object({
|
1224
|
+
outcome: z4.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
|
1225
|
+
output: z4.string().describe("The output from the code execution.")
|
1227
1226
|
})
|
1228
1227
|
});
|
1229
1228
|
|
1229
|
+
// src/tool/google-search.ts
|
1230
|
+
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
1231
|
+
var z5 = __toESM(require("zod/v4"));
|
1232
|
+
var googleSearch = (0, import_provider_utils6.createProviderDefinedToolFactory)({
|
1233
|
+
id: "google.google_search",
|
1234
|
+
name: "google_search",
|
1235
|
+
inputSchema: (0, import_provider_utils6.lazySchema)(
|
1236
|
+
() => (0, import_provider_utils6.zodSchema)(
|
1237
|
+
z5.object({
|
1238
|
+
mode: z5.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
1239
|
+
dynamicThreshold: z5.number().default(1)
|
1240
|
+
})
|
1241
|
+
)
|
1242
|
+
)
|
1243
|
+
});
|
1244
|
+
|
1245
|
+
// src/tool/url-context.ts
|
1246
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
1247
|
+
var z6 = __toESM(require("zod/v4"));
|
1248
|
+
var urlContext = (0, import_provider_utils7.createProviderDefinedToolFactory)({
|
1249
|
+
id: "google.url_context",
|
1250
|
+
name: "url_context",
|
1251
|
+
inputSchema: (0, import_provider_utils7.lazySchema)(() => (0, import_provider_utils7.zodSchema)(z6.object({})))
|
1252
|
+
});
|
1253
|
+
|
1230
1254
|
// src/google-tools.ts
|
1231
1255
|
var googleTools = {
|
1232
1256
|
/**
|
@@ -1254,7 +1278,8 @@ var googleTools = {
|
|
1254
1278
|
// Annotate the CommonJS export names for ESM import in node:
|
1255
1279
|
0 && (module.exports = {
|
1256
1280
|
GoogleGenerativeAILanguageModel,
|
1257
|
-
|
1258
|
-
|
1281
|
+
getGroundingMetadataSchema,
|
1282
|
+
getUrlContextMetadataSchema,
|
1283
|
+
googleTools
|
1259
1284
|
});
|
1260
1285
|
//# sourceMappingURL=index.js.map
|