@ai-sdk/google 2.0.18 → 2.0.19
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 +8 -0
- package/dist/index.d.mts +139 -132
- package/dist/index.d.ts +139 -132
- package/dist/index.js +312 -257
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +319 -240
- 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 -210
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +249 -197
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
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,30 +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
|
-
});
|
413
|
+
)
|
414
|
+
);
|
394
415
|
|
395
416
|
// src/google-prepare-tools.ts
|
396
417
|
var import_provider2 = require("@ai-sdk/provider");
|
@@ -561,64 +582,6 @@ function mapGoogleGenerativeAIFinishReason({
|
|
561
582
|
}
|
562
583
|
}
|
563
584
|
|
564
|
-
// src/tool/google-search.ts
|
565
|
-
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
566
|
-
var z3 = __toESM(require("zod/v4"));
|
567
|
-
var groundingChunkSchema = z3.object({
|
568
|
-
web: z3.object({ uri: z3.string(), title: z3.string() }).nullish(),
|
569
|
-
retrievedContext: z3.object({ uri: z3.string(), title: z3.string() }).nullish()
|
570
|
-
});
|
571
|
-
var groundingMetadataSchema = z3.object({
|
572
|
-
webSearchQueries: z3.array(z3.string()).nullish(),
|
573
|
-
retrievalQueries: z3.array(z3.string()).nullish(),
|
574
|
-
searchEntryPoint: z3.object({ renderedContent: z3.string() }).nullish(),
|
575
|
-
groundingChunks: z3.array(groundingChunkSchema).nullish(),
|
576
|
-
groundingSupports: z3.array(
|
577
|
-
z3.object({
|
578
|
-
segment: z3.object({
|
579
|
-
startIndex: z3.number().nullish(),
|
580
|
-
endIndex: z3.number().nullish(),
|
581
|
-
text: z3.string().nullish()
|
582
|
-
}),
|
583
|
-
segment_text: z3.string().nullish(),
|
584
|
-
groundingChunkIndices: z3.array(z3.number()).nullish(),
|
585
|
-
supportChunkIndices: z3.array(z3.number()).nullish(),
|
586
|
-
confidenceScores: z3.array(z3.number()).nullish(),
|
587
|
-
confidenceScore: z3.array(z3.number()).nullish()
|
588
|
-
})
|
589
|
-
).nullish(),
|
590
|
-
retrievalMetadata: z3.union([
|
591
|
-
z3.object({
|
592
|
-
webDynamicRetrievalScore: z3.number()
|
593
|
-
}),
|
594
|
-
z3.object({})
|
595
|
-
]).nullish()
|
596
|
-
});
|
597
|
-
var googleSearch = (0, import_provider_utils3.createProviderDefinedToolFactory)({
|
598
|
-
id: "google.google_search",
|
599
|
-
name: "google_search",
|
600
|
-
inputSchema: z3.object({
|
601
|
-
mode: z3.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
602
|
-
dynamicThreshold: z3.number().default(1)
|
603
|
-
})
|
604
|
-
});
|
605
|
-
|
606
|
-
// src/tool/url-context.ts
|
607
|
-
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
608
|
-
var z4 = __toESM(require("zod/v4"));
|
609
|
-
var urlMetadataSchema = z4.object({
|
610
|
-
retrievedUrl: z4.string(),
|
611
|
-
urlRetrievalStatus: z4.string()
|
612
|
-
});
|
613
|
-
var urlContextMetadataSchema = z4.object({
|
614
|
-
urlMetadata: z4.array(urlMetadataSchema)
|
615
|
-
});
|
616
|
-
var urlContext = (0, import_provider_utils4.createProviderDefinedToolFactory)({
|
617
|
-
id: "google.url_context",
|
618
|
-
name: "url_context",
|
619
|
-
inputSchema: z4.object({})
|
620
|
-
});
|
621
|
-
|
622
585
|
// src/google-generative-ai-language-model.ts
|
623
586
|
var GoogleGenerativeAILanguageModel = class {
|
624
587
|
constructor(modelId, config) {
|
@@ -626,7 +589,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
626
589
|
var _a;
|
627
590
|
this.modelId = modelId;
|
628
591
|
this.config = config;
|
629
|
-
this.generateId = (_a = config.generateId) != null ? _a :
|
592
|
+
this.generateId = (_a = config.generateId) != null ? _a : import_provider_utils4.generateId;
|
630
593
|
}
|
631
594
|
get provider() {
|
632
595
|
return this.config.provider;
|
@@ -652,7 +615,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
652
615
|
}) {
|
653
616
|
var _a, _b;
|
654
617
|
const warnings = [];
|
655
|
-
const googleOptions = await (0,
|
618
|
+
const googleOptions = await (0, import_provider_utils4.parseProviderOptions)({
|
656
619
|
provider: "google",
|
657
620
|
providerOptions,
|
658
621
|
schema: googleGenerativeAIProviderOptions
|
@@ -717,22 +680,22 @@ var GoogleGenerativeAILanguageModel = class {
|
|
717
680
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
718
681
|
const { args, warnings } = await this.getArgs(options);
|
719
682
|
const body = JSON.stringify(args);
|
720
|
-
const mergedHeaders = (0,
|
721
|
-
await (0,
|
683
|
+
const mergedHeaders = (0, import_provider_utils4.combineHeaders)(
|
684
|
+
await (0, import_provider_utils4.resolve)(this.config.headers),
|
722
685
|
options.headers
|
723
686
|
);
|
724
687
|
const {
|
725
688
|
responseHeaders,
|
726
689
|
value: response,
|
727
690
|
rawValue: rawResponse
|
728
|
-
} = await (0,
|
691
|
+
} = await (0, import_provider_utils4.postJsonToApi)({
|
729
692
|
url: `${this.config.baseURL}/${getModelPath(
|
730
693
|
this.modelId
|
731
694
|
)}:generateContent`,
|
732
695
|
headers: mergedHeaders,
|
733
696
|
body: args,
|
734
697
|
failedResponseHandler: googleFailedResponseHandler,
|
735
|
-
successfulResponseHandler: (0,
|
698
|
+
successfulResponseHandler: (0, import_provider_utils4.createJsonResponseHandler)(responseSchema),
|
736
699
|
abortSignal: options.abortSignal,
|
737
700
|
fetch: this.config.fetch
|
738
701
|
});
|
@@ -828,18 +791,18 @@ var GoogleGenerativeAILanguageModel = class {
|
|
828
791
|
async doStream(options) {
|
829
792
|
const { args, warnings } = await this.getArgs(options);
|
830
793
|
const body = JSON.stringify(args);
|
831
|
-
const headers = (0,
|
832
|
-
await (0,
|
794
|
+
const headers = (0, import_provider_utils4.combineHeaders)(
|
795
|
+
await (0, import_provider_utils4.resolve)(this.config.headers),
|
833
796
|
options.headers
|
834
797
|
);
|
835
|
-
const { responseHeaders, value: response } = await (0,
|
798
|
+
const { responseHeaders, value: response } = await (0, import_provider_utils4.postJsonToApi)({
|
836
799
|
url: `${this.config.baseURL}/${getModelPath(
|
837
800
|
this.modelId
|
838
801
|
)}:streamGenerateContent?alt=sse`,
|
839
802
|
headers,
|
840
803
|
body: args,
|
841
804
|
failedResponseHandler: googleFailedResponseHandler,
|
842
|
-
successfulResponseHandler: (0,
|
805
|
+
successfulResponseHandler: (0, import_provider_utils4.createEventSourceResponseHandler)(chunkSchema),
|
843
806
|
abortSignal: options.abortSignal,
|
844
807
|
fetch: this.config.fetch
|
845
808
|
});
|
@@ -1111,103 +1074,175 @@ function extractSources({
|
|
1111
1074
|
title: chunk.web.title
|
1112
1075
|
}));
|
1113
1076
|
}
|
1114
|
-
var
|
1115
|
-
|
1116
|
-
|
1077
|
+
var getGroundingMetadataSchema = () => z3.object({
|
1078
|
+
webSearchQueries: z3.array(z3.string()).nullish(),
|
1079
|
+
retrievalQueries: z3.array(z3.string()).nullish(),
|
1080
|
+
searchEntryPoint: z3.object({ renderedContent: z3.string() }).nullish(),
|
1081
|
+
groundingChunks: z3.array(
|
1082
|
+
z3.object({
|
1083
|
+
web: z3.object({ uri: z3.string(), title: z3.string() }).nullish(),
|
1084
|
+
retrievedContext: z3.object({ uri: z3.string(), title: z3.string() }).nullish()
|
1085
|
+
})
|
1086
|
+
).nullish(),
|
1087
|
+
groundingSupports: z3.array(
|
1088
|
+
z3.object({
|
1089
|
+
segment: z3.object({
|
1090
|
+
startIndex: z3.number().nullish(),
|
1091
|
+
endIndex: z3.number().nullish(),
|
1092
|
+
text: z3.string().nullish()
|
1093
|
+
}),
|
1094
|
+
segment_text: z3.string().nullish(),
|
1095
|
+
groundingChunkIndices: z3.array(z3.number()).nullish(),
|
1096
|
+
supportChunkIndices: z3.array(z3.number()).nullish(),
|
1097
|
+
confidenceScores: z3.array(z3.number()).nullish(),
|
1098
|
+
confidenceScore: z3.array(z3.number()).nullish()
|
1099
|
+
})
|
1100
|
+
).nullish(),
|
1101
|
+
retrievalMetadata: z3.union([
|
1102
|
+
z3.object({
|
1103
|
+
webDynamicRetrievalScore: z3.number()
|
1104
|
+
}),
|
1105
|
+
z3.object({})
|
1106
|
+
]).nullish()
|
1107
|
+
});
|
1108
|
+
var getContentSchema = () => z3.object({
|
1109
|
+
parts: z3.array(
|
1110
|
+
z3.union([
|
1117
1111
|
// note: order matters since text can be fully empty
|
1118
|
-
|
1119
|
-
functionCall:
|
1120
|
-
name:
|
1121
|
-
args:
|
1112
|
+
z3.object({
|
1113
|
+
functionCall: z3.object({
|
1114
|
+
name: z3.string(),
|
1115
|
+
args: z3.unknown()
|
1122
1116
|
}),
|
1123
|
-
thoughtSignature:
|
1117
|
+
thoughtSignature: z3.string().nullish()
|
1124
1118
|
}),
|
1125
|
-
|
1126
|
-
inlineData:
|
1127
|
-
mimeType:
|
1128
|
-
data:
|
1119
|
+
z3.object({
|
1120
|
+
inlineData: z3.object({
|
1121
|
+
mimeType: z3.string(),
|
1122
|
+
data: z3.string()
|
1129
1123
|
})
|
1130
1124
|
}),
|
1131
|
-
|
1132
|
-
executableCode:
|
1133
|
-
language:
|
1134
|
-
code:
|
1125
|
+
z3.object({
|
1126
|
+
executableCode: z3.object({
|
1127
|
+
language: z3.string(),
|
1128
|
+
code: z3.string()
|
1135
1129
|
}).nullish(),
|
1136
|
-
codeExecutionResult:
|
1137
|
-
outcome:
|
1138
|
-
output:
|
1130
|
+
codeExecutionResult: z3.object({
|
1131
|
+
outcome: z3.string(),
|
1132
|
+
output: z3.string()
|
1139
1133
|
}).nullish(),
|
1140
|
-
text:
|
1141
|
-
thought:
|
1142
|
-
thoughtSignature:
|
1134
|
+
text: z3.string().nullish(),
|
1135
|
+
thought: z3.boolean().nullish(),
|
1136
|
+
thoughtSignature: z3.string().nullish()
|
1143
1137
|
})
|
1144
1138
|
])
|
1145
1139
|
).nullish()
|
1146
1140
|
});
|
1147
|
-
var
|
1148
|
-
category:
|
1149
|
-
probability:
|
1150
|
-
probabilityScore:
|
1151
|
-
severity:
|
1152
|
-
severityScore:
|
1153
|
-
blocked:
|
1141
|
+
var getSafetyRatingSchema = () => z3.object({
|
1142
|
+
category: z3.string().nullish(),
|
1143
|
+
probability: z3.string().nullish(),
|
1144
|
+
probabilityScore: z3.number().nullish(),
|
1145
|
+
severity: z3.string().nullish(),
|
1146
|
+
severityScore: z3.number().nullish(),
|
1147
|
+
blocked: z3.boolean().nullish()
|
1154
1148
|
});
|
1155
|
-
var usageSchema =
|
1156
|
-
cachedContentTokenCount:
|
1157
|
-
thoughtsTokenCount:
|
1158
|
-
promptTokenCount:
|
1159
|
-
candidatesTokenCount:
|
1160
|
-
totalTokenCount:
|
1149
|
+
var usageSchema = z3.object({
|
1150
|
+
cachedContentTokenCount: z3.number().nullish(),
|
1151
|
+
thoughtsTokenCount: z3.number().nullish(),
|
1152
|
+
promptTokenCount: z3.number().nullish(),
|
1153
|
+
candidatesTokenCount: z3.number().nullish(),
|
1154
|
+
totalTokenCount: z3.number().nullish()
|
1161
1155
|
});
|
1162
|
-
var
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
safetyRatings: z5.array(safetyRatingSchema).nullish(),
|
1168
|
-
groundingMetadata: groundingMetadataSchema.nullish(),
|
1169
|
-
urlContextMetadata: urlContextMetadataSchema.nullish()
|
1156
|
+
var getUrlContextMetadataSchema = () => z3.object({
|
1157
|
+
urlMetadata: z3.array(
|
1158
|
+
z3.object({
|
1159
|
+
retrievedUrl: z3.string(),
|
1160
|
+
urlRetrievalStatus: z3.string()
|
1170
1161
|
})
|
1171
|
-
)
|
1172
|
-
usageMetadata: usageSchema.nullish(),
|
1173
|
-
promptFeedback: z5.object({
|
1174
|
-
blockReason: z5.string().nullish(),
|
1175
|
-
safetyRatings: z5.array(safetyRatingSchema).nullish()
|
1176
|
-
}).nullish()
|
1162
|
+
)
|
1177
1163
|
});
|
1178
|
-
var
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1164
|
+
var responseSchema = (0, import_provider_utils4.lazySchema)(
|
1165
|
+
() => (0, import_provider_utils4.zodSchema)(
|
1166
|
+
z3.object({
|
1167
|
+
candidates: z3.array(
|
1168
|
+
z3.object({
|
1169
|
+
content: getContentSchema().nullish().or(z3.object({}).strict()),
|
1170
|
+
finishReason: z3.string().nullish(),
|
1171
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
|
1172
|
+
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
1173
|
+
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
1174
|
+
})
|
1175
|
+
),
|
1176
|
+
usageMetadata: usageSchema.nullish(),
|
1177
|
+
promptFeedback: z3.object({
|
1178
|
+
blockReason: z3.string().nullish(),
|
1179
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
|
1180
|
+
}).nullish()
|
1186
1181
|
})
|
1187
|
-
)
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1182
|
+
)
|
1183
|
+
);
|
1184
|
+
var chunkSchema = (0, import_provider_utils4.lazySchema)(
|
1185
|
+
() => (0, import_provider_utils4.zodSchema)(
|
1186
|
+
z3.object({
|
1187
|
+
candidates: z3.array(
|
1188
|
+
z3.object({
|
1189
|
+
content: getContentSchema().nullish(),
|
1190
|
+
finishReason: z3.string().nullish(),
|
1191
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
|
1192
|
+
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
1193
|
+
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
1194
|
+
})
|
1195
|
+
).nullish(),
|
1196
|
+
usageMetadata: usageSchema.nullish(),
|
1197
|
+
promptFeedback: z3.object({
|
1198
|
+
blockReason: z3.string().nullish(),
|
1199
|
+
safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
|
1200
|
+
}).nullish()
|
1201
|
+
})
|
1202
|
+
)
|
1203
|
+
);
|
1194
1204
|
|
1195
1205
|
// src/tool/code-execution.ts
|
1196
|
-
var
|
1197
|
-
var
|
1198
|
-
var codeExecution = (0,
|
1206
|
+
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
1207
|
+
var z4 = __toESM(require("zod/v4"));
|
1208
|
+
var codeExecution = (0, import_provider_utils5.createProviderDefinedToolFactoryWithOutputSchema)({
|
1199
1209
|
id: "google.code_execution",
|
1200
1210
|
name: "code_execution",
|
1201
|
-
inputSchema:
|
1202
|
-
language:
|
1203
|
-
code:
|
1211
|
+
inputSchema: z4.object({
|
1212
|
+
language: z4.string().describe("The programming language of the code."),
|
1213
|
+
code: z4.string().describe("The code to be executed.")
|
1204
1214
|
}),
|
1205
|
-
outputSchema:
|
1206
|
-
outcome:
|
1207
|
-
output:
|
1215
|
+
outputSchema: z4.object({
|
1216
|
+
outcome: z4.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
|
1217
|
+
output: z4.string().describe("The output from the code execution.")
|
1208
1218
|
})
|
1209
1219
|
});
|
1210
1220
|
|
1221
|
+
// src/tool/google-search.ts
|
1222
|
+
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
1223
|
+
var z5 = __toESM(require("zod/v4"));
|
1224
|
+
var googleSearch = (0, import_provider_utils6.createProviderDefinedToolFactory)({
|
1225
|
+
id: "google.google_search",
|
1226
|
+
name: "google_search",
|
1227
|
+
inputSchema: (0, import_provider_utils6.lazySchema)(
|
1228
|
+
() => (0, import_provider_utils6.zodSchema)(
|
1229
|
+
z5.object({
|
1230
|
+
mode: z5.enum(["MODE_DYNAMIC", "MODE_UNSPECIFIED"]).default("MODE_UNSPECIFIED"),
|
1231
|
+
dynamicThreshold: z5.number().default(1)
|
1232
|
+
})
|
1233
|
+
)
|
1234
|
+
)
|
1235
|
+
});
|
1236
|
+
|
1237
|
+
// src/tool/url-context.ts
|
1238
|
+
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
1239
|
+
var z6 = __toESM(require("zod/v4"));
|
1240
|
+
var urlContext = (0, import_provider_utils7.createProviderDefinedToolFactory)({
|
1241
|
+
id: "google.url_context",
|
1242
|
+
name: "url_context",
|
1243
|
+
inputSchema: (0, import_provider_utils7.lazySchema)(() => (0, import_provider_utils7.zodSchema)(z6.object({})))
|
1244
|
+
});
|
1245
|
+
|
1211
1246
|
// src/google-tools.ts
|
1212
1247
|
var googleTools = {
|
1213
1248
|
/**
|
@@ -1235,7 +1270,8 @@ var googleTools = {
|
|
1235
1270
|
// Annotate the CommonJS export names for ESM import in node:
|
1236
1271
|
0 && (module.exports = {
|
1237
1272
|
GoogleGenerativeAILanguageModel,
|
1238
|
-
|
1239
|
-
|
1273
|
+
getGroundingMetadataSchema,
|
1274
|
+
getUrlContextMetadataSchema,
|
1275
|
+
googleTools
|
1240
1276
|
});
|
1241
1277
|
//# sourceMappingURL=index.js.map
|