@ai-sdk/google 3.0.138 → 3.0.140
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 +16 -0
- package/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +570 -519
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +570 -519
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +544 -493
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +544 -493
- package/dist/internal/index.mjs.map +1 -1
- package/docs/15-google-generative-ai.mdx +18 -2
- package/package.json +2 -2
- package/src/convert-to-google-generative-ai-messages.ts +17 -5
- package/src/google-generative-ai-prompt.ts +21 -2
- package/src/google-json-accumulator.ts +52 -3
- package/src/index.ts +4 -1
package/dist/internal/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
resolve,
|
|
11
11
|
zodSchema as zodSchema3
|
|
12
12
|
} from "@ai-sdk/provider-utils";
|
|
13
|
-
import { z as
|
|
13
|
+
import { z as z4 } from "zod/v4";
|
|
14
14
|
|
|
15
15
|
// src/continue-google-stream.ts
|
|
16
16
|
function continueGoogleStream({
|
|
@@ -441,6 +441,19 @@ import {
|
|
|
441
441
|
isUrlSupported,
|
|
442
442
|
secureJsonParse
|
|
443
443
|
} from "@ai-sdk/provider-utils";
|
|
444
|
+
|
|
445
|
+
// src/google-generative-ai-prompt.ts
|
|
446
|
+
import { z } from "zod/v4";
|
|
447
|
+
var googleVideoMetadataSchema = z.object({
|
|
448
|
+
/** Start offset as a duration in seconds, e.g. `'3.5s'`. */
|
|
449
|
+
startOffset: z.string().optional(),
|
|
450
|
+
/** End offset as a duration in seconds, e.g. `'10s'`. */
|
|
451
|
+
endOffset: z.string().optional(),
|
|
452
|
+
/** Frames per second in the range (0, 24]. Defaults to 1. */
|
|
453
|
+
fps: z.number().gt(0).max(24).optional()
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
// src/convert-to-google-generative-ai-messages.ts
|
|
444
457
|
var SKIP_THOUGHT_SIGNATURE_VALIDATOR = "skip_thought_signature_validator";
|
|
445
458
|
function getGoogleProviderOptions(providerOptions, providerOptionsName) {
|
|
446
459
|
const namespaces = [
|
|
@@ -579,7 +592,7 @@ function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId, i
|
|
|
579
592
|
}
|
|
580
593
|
}
|
|
581
594
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
582
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
595
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
583
596
|
const systemInstructionParts = [];
|
|
584
597
|
const contents = [];
|
|
585
598
|
let systemMessagesAllowed = true;
|
|
@@ -619,17 +632,24 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
619
632
|
}
|
|
620
633
|
case "file": {
|
|
621
634
|
const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
|
|
635
|
+
const rawVideoMetadata = (_g = getGoogleProviderOptions(
|
|
636
|
+
part.providerOptions,
|
|
637
|
+
providerOptionsName
|
|
638
|
+
)) == null ? void 0 : _g.videoMetadata;
|
|
639
|
+
const videoMetadata = rawVideoMetadata == null ? void 0 : googleVideoMetadataSchema.parse(rawVideoMetadata);
|
|
622
640
|
parts.push(
|
|
623
641
|
part.data instanceof URL ? {
|
|
624
642
|
fileData: {
|
|
625
643
|
mimeType: mediaType,
|
|
626
644
|
fileUri: part.data.protocol === "gs:" && part.originalUrl != null ? part.originalUrl : part.data.toString()
|
|
627
|
-
}
|
|
645
|
+
},
|
|
646
|
+
...videoMetadata != null ? { videoMetadata } : {}
|
|
628
647
|
} : {
|
|
629
648
|
inlineData: {
|
|
630
649
|
mimeType: mediaType,
|
|
631
650
|
data: convertToBase64(part.data)
|
|
632
|
-
}
|
|
651
|
+
},
|
|
652
|
+
...videoMetadata != null ? { videoMetadata } : {}
|
|
633
653
|
}
|
|
634
654
|
);
|
|
635
655
|
break;
|
|
@@ -790,7 +810,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
790
810
|
name: part.toolName,
|
|
791
811
|
response: {
|
|
792
812
|
name: part.toolName,
|
|
793
|
-
content: output.type === "execution-denied" ? (
|
|
813
|
+
content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool call execution denied." : output.value
|
|
794
814
|
}
|
|
795
815
|
}
|
|
796
816
|
});
|
|
@@ -902,15 +922,15 @@ import {
|
|
|
902
922
|
lazySchema,
|
|
903
923
|
zodSchema
|
|
904
924
|
} from "@ai-sdk/provider-utils";
|
|
905
|
-
import { z } from "zod/v4";
|
|
925
|
+
import { z as z2 } from "zod/v4";
|
|
906
926
|
var googleErrorDataSchema = lazySchema(
|
|
907
927
|
() => zodSchema(
|
|
908
|
-
|
|
909
|
-
error:
|
|
910
|
-
code:
|
|
911
|
-
message:
|
|
912
|
-
status:
|
|
913
|
-
details:
|
|
928
|
+
z2.object({
|
|
929
|
+
error: z2.object({
|
|
930
|
+
code: z2.number().nullable(),
|
|
931
|
+
message: z2.string(),
|
|
932
|
+
status: z2.string(),
|
|
933
|
+
details: z2.array(z2.unknown()).nullish()
|
|
914
934
|
})
|
|
915
935
|
})
|
|
916
936
|
)
|
|
@@ -925,23 +945,23 @@ import {
|
|
|
925
945
|
lazySchema as lazySchema2,
|
|
926
946
|
zodSchema as zodSchema2
|
|
927
947
|
} from "@ai-sdk/provider-utils";
|
|
928
|
-
import { z as
|
|
948
|
+
import { z as z3 } from "zod/v4";
|
|
929
949
|
var googleLanguageModelOptions = lazySchema2(
|
|
930
950
|
() => zodSchema2(
|
|
931
|
-
|
|
932
|
-
responseModalities:
|
|
933
|
-
thinkingConfig:
|
|
934
|
-
thinkingBudget:
|
|
935
|
-
includeThoughts:
|
|
951
|
+
z3.object({
|
|
952
|
+
responseModalities: z3.array(z3.enum(["TEXT", "IMAGE"])).optional(),
|
|
953
|
+
thinkingConfig: z3.object({
|
|
954
|
+
thinkingBudget: z3.number().optional(),
|
|
955
|
+
includeThoughts: z3.boolean().optional(),
|
|
936
956
|
// https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level
|
|
937
|
-
thinkingLevel:
|
|
957
|
+
thinkingLevel: z3.enum(["minimal", "low", "medium", "high"]).optional()
|
|
938
958
|
}).optional(),
|
|
939
959
|
/**
|
|
940
960
|
* Optional.
|
|
941
961
|
* The name of the cached content used as context to serve the prediction.
|
|
942
962
|
* Format: cachedContents/{cachedContent}
|
|
943
963
|
*/
|
|
944
|
-
cachedContent:
|
|
964
|
+
cachedContent: z3.string().optional(),
|
|
945
965
|
/**
|
|
946
966
|
* Optional. Enable structured output. Default is true.
|
|
947
967
|
*
|
|
@@ -950,13 +970,13 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
950
970
|
* Google Generative AI uses. You can use this to disable
|
|
951
971
|
* structured outputs if you need to.
|
|
952
972
|
*/
|
|
953
|
-
structuredOutputs:
|
|
973
|
+
structuredOutputs: z3.boolean().optional(),
|
|
954
974
|
/**
|
|
955
975
|
* Optional. A list of unique safety settings for blocking unsafe content.
|
|
956
976
|
*/
|
|
957
|
-
safetySettings:
|
|
958
|
-
|
|
959
|
-
category:
|
|
977
|
+
safetySettings: z3.array(
|
|
978
|
+
z3.object({
|
|
979
|
+
category: z3.enum([
|
|
960
980
|
"HARM_CATEGORY_UNSPECIFIED",
|
|
961
981
|
"HARM_CATEGORY_HATE_SPEECH",
|
|
962
982
|
"HARM_CATEGORY_DANGEROUS_CONTENT",
|
|
@@ -964,7 +984,7 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
964
984
|
"HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
|
965
985
|
"HARM_CATEGORY_CIVIC_INTEGRITY"
|
|
966
986
|
]),
|
|
967
|
-
threshold:
|
|
987
|
+
threshold: z3.enum([
|
|
968
988
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
|
969
989
|
"BLOCK_LOW_AND_ABOVE",
|
|
970
990
|
"BLOCK_MEDIUM_AND_ABOVE",
|
|
@@ -974,7 +994,7 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
974
994
|
])
|
|
975
995
|
})
|
|
976
996
|
).optional(),
|
|
977
|
-
threshold:
|
|
997
|
+
threshold: z3.enum([
|
|
978
998
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
|
979
999
|
"BLOCK_LOW_AND_ABOVE",
|
|
980
1000
|
"BLOCK_MEDIUM_AND_ABOVE",
|
|
@@ -987,19 +1007,19 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
987
1007
|
*
|
|
988
1008
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
|
|
989
1009
|
*/
|
|
990
|
-
audioTimestamp:
|
|
1010
|
+
audioTimestamp: z3.boolean().optional(),
|
|
991
1011
|
/**
|
|
992
1012
|
* Optional. Defines labels used in billing reports. Available on Vertex AI only.
|
|
993
1013
|
*
|
|
994
1014
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
|
|
995
1015
|
*/
|
|
996
|
-
labels:
|
|
1016
|
+
labels: z3.record(z3.string(), z3.string()).optional(),
|
|
997
1017
|
/**
|
|
998
1018
|
* Optional. If specified, the media resolution specified will be used.
|
|
999
1019
|
*
|
|
1000
1020
|
* https://ai.google.dev/api/generate-content#MediaResolution
|
|
1001
1021
|
*/
|
|
1002
|
-
mediaResolution:
|
|
1022
|
+
mediaResolution: z3.enum([
|
|
1003
1023
|
"MEDIA_RESOLUTION_UNSPECIFIED",
|
|
1004
1024
|
"MEDIA_RESOLUTION_LOW",
|
|
1005
1025
|
"MEDIA_RESOLUTION_MEDIUM",
|
|
@@ -1010,8 +1030,8 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
1010
1030
|
*
|
|
1011
1031
|
* https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios
|
|
1012
1032
|
*/
|
|
1013
|
-
imageConfig:
|
|
1014
|
-
aspectRatio:
|
|
1033
|
+
imageConfig: z3.object({
|
|
1034
|
+
aspectRatio: z3.enum([
|
|
1015
1035
|
"1:1",
|
|
1016
1036
|
"2:3",
|
|
1017
1037
|
"3:2",
|
|
@@ -1027,12 +1047,12 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
1027
1047
|
"1:4",
|
|
1028
1048
|
"4:1"
|
|
1029
1049
|
]).optional(),
|
|
1030
|
-
imageSize:
|
|
1050
|
+
imageSize: z3.enum(["1K", "2K", "4K", "512"]).optional(),
|
|
1031
1051
|
/**
|
|
1032
1052
|
* Optional. Controls the generation of people in images.
|
|
1033
1053
|
* Vertex AI only.
|
|
1034
1054
|
*/
|
|
1035
|
-
personGeneration:
|
|
1055
|
+
personGeneration: z3.enum([
|
|
1036
1056
|
"PERSON_GENERATION_UNSPECIFIED",
|
|
1037
1057
|
"ALLOW_ALL",
|
|
1038
1058
|
"ALLOW_ADULT",
|
|
@@ -1046,7 +1066,7 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
1046
1066
|
*
|
|
1047
1067
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
|
|
1048
1068
|
*/
|
|
1049
|
-
prominentPeople:
|
|
1069
|
+
prominentPeople: z3.enum([
|
|
1050
1070
|
"PROMINENT_PEOPLE_UNSPECIFIED",
|
|
1051
1071
|
"ALLOW_PROMINENT_PEOPLE",
|
|
1052
1072
|
"BLOCK_PROMINENT_PEOPLE"
|
|
@@ -1055,9 +1075,9 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
1055
1075
|
* Optional. The image output format for generated images.
|
|
1056
1076
|
* Vertex AI only.
|
|
1057
1077
|
*/
|
|
1058
|
-
imageOutputOptions:
|
|
1059
|
-
mimeType:
|
|
1060
|
-
compressionQuality:
|
|
1078
|
+
imageOutputOptions: z3.object({
|
|
1079
|
+
mimeType: z3.enum(["image/jpeg", "image/png"]).optional(),
|
|
1080
|
+
compressionQuality: z3.number().optional()
|
|
1061
1081
|
}).optional()
|
|
1062
1082
|
}).optional(),
|
|
1063
1083
|
/**
|
|
@@ -1066,10 +1086,10 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
1066
1086
|
*
|
|
1067
1087
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
1068
1088
|
*/
|
|
1069
|
-
retrievalConfig:
|
|
1070
|
-
latLng:
|
|
1071
|
-
latitude:
|
|
1072
|
-
longitude:
|
|
1089
|
+
retrievalConfig: z3.object({
|
|
1090
|
+
latLng: z3.object({
|
|
1091
|
+
latitude: z3.number(),
|
|
1092
|
+
longitude: z3.number()
|
|
1073
1093
|
}).optional()
|
|
1074
1094
|
}).optional(),
|
|
1075
1095
|
/**
|
|
@@ -1082,12 +1102,12 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
1082
1102
|
*
|
|
1083
1103
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc
|
|
1084
1104
|
*/
|
|
1085
|
-
streamFunctionCallArguments:
|
|
1105
|
+
streamFunctionCallArguments: z3.boolean().optional(),
|
|
1086
1106
|
/**
|
|
1087
1107
|
* Optional. The service tier to use for the request. Sent as the
|
|
1088
1108
|
* `serviceTier` body field. Gemini API only.
|
|
1089
1109
|
*/
|
|
1090
|
-
serviceTier:
|
|
1110
|
+
serviceTier: z3.enum(["standard", "flex", "priority"]).optional(),
|
|
1091
1111
|
/**
|
|
1092
1112
|
* Optional. Resumes a response that stopped with `MAX_TOKENS` because it
|
|
1093
1113
|
* used up its `maxOutputTokens` budget (Gemini 4 long decode). Pass the
|
|
@@ -1097,7 +1117,7 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
1097
1117
|
* per-request cap while budget remains (`CONTINUATION`) are continued
|
|
1098
1118
|
* automatically. Sent as the `continuationToken` body field.
|
|
1099
1119
|
*/
|
|
1100
|
-
continuationToken:
|
|
1120
|
+
continuationToken: z3.string().optional(),
|
|
1101
1121
|
/**
|
|
1102
1122
|
* Optional. Vertex AI only. Sent as the
|
|
1103
1123
|
* `X-Vertex-AI-LLM-Shared-Request-Type` request header to select a
|
|
@@ -1108,7 +1128,7 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
1108
1128
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/priority-paygo
|
|
1109
1129
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/flex-paygo
|
|
1110
1130
|
*/
|
|
1111
|
-
sharedRequestType:
|
|
1131
|
+
sharedRequestType: z3.enum(["priority", "flex", "standard"]).optional(),
|
|
1112
1132
|
/**
|
|
1113
1133
|
* Optional. Vertex AI only. Sent as the `X-Vertex-AI-LLM-Request-Type`
|
|
1114
1134
|
* request header. Set to `'shared'` together with `sharedRequestType`
|
|
@@ -1116,7 +1136,7 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
1116
1136
|
*
|
|
1117
1137
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/priority-paygo
|
|
1118
1138
|
*/
|
|
1119
|
-
requestType:
|
|
1139
|
+
requestType: z3.enum(["shared"]).optional()
|
|
1120
1140
|
})
|
|
1121
1141
|
)
|
|
1122
1142
|
);
|
|
@@ -1425,8 +1445,10 @@ var GoogleJSONAccumulator = class {
|
|
|
1425
1445
|
processPartialArgs(partialArgs) {
|
|
1426
1446
|
let delta = "";
|
|
1427
1447
|
for (const arg of partialArgs) {
|
|
1428
|
-
const
|
|
1429
|
-
|
|
1448
|
+
const isArrayTerminator = arg.jsonPath.endsWith("[]");
|
|
1449
|
+
const jsonPath = isArrayTerminator ? arg.jsonPath.slice(0, -2) : arg.jsonPath;
|
|
1450
|
+
const rawPath = jsonPath.replace(/^\$\./, "");
|
|
1451
|
+
if (!rawPath || rawPath === "$") continue;
|
|
1430
1452
|
const segments = parsePath(rawPath);
|
|
1431
1453
|
const existingValue = getNestedValue(this.accumulatedArgs, segments);
|
|
1432
1454
|
const isStringContinuation = arg.stringValue != null && existingValue !== void 0;
|
|
@@ -1441,7 +1463,16 @@ var GoogleJSONAccumulator = class {
|
|
|
1441
1463
|
continue;
|
|
1442
1464
|
}
|
|
1443
1465
|
const resolved = resolvePartialArgValue(arg);
|
|
1444
|
-
if (resolved == null)
|
|
1466
|
+
if (resolved == null) {
|
|
1467
|
+
if (existingValue !== void 0 || arg.willContinue === true) continue;
|
|
1468
|
+
setNestedValue(
|
|
1469
|
+
this.accumulatedArgs,
|
|
1470
|
+
segments,
|
|
1471
|
+
isArrayTerminator ? [] : {}
|
|
1472
|
+
);
|
|
1473
|
+
delta += this.emitContainer(segments, isArrayTerminator);
|
|
1474
|
+
continue;
|
|
1475
|
+
}
|
|
1445
1476
|
setNestedValue(this.accumulatedArgs, segments, resolved.value);
|
|
1446
1477
|
delta += this.emitNavigationTo(segments, arg, resolved.json);
|
|
1447
1478
|
}
|
|
@@ -1493,6 +1524,26 @@ var GoogleJSONAccumulator = class {
|
|
|
1493
1524
|
fragment += this.emitLeaf(leafSegment, arg, valueJson);
|
|
1494
1525
|
return fragment;
|
|
1495
1526
|
}
|
|
1527
|
+
/**
|
|
1528
|
+
* Navigates to `targetSegments` and opens a container there. The container
|
|
1529
|
+
* stays open so later entries for its children continue inside it; it is
|
|
1530
|
+
* closed by subsequent navigation or by `finalize()`.
|
|
1531
|
+
*
|
|
1532
|
+
* Input: targetSegments=["nested","tags"], isArray=true
|
|
1533
|
+
* Output: '{"nested":{"tags":['
|
|
1534
|
+
*/
|
|
1535
|
+
emitContainer(targetSegments, isArray) {
|
|
1536
|
+
let fragment = "";
|
|
1537
|
+
if (this.stringOpen) {
|
|
1538
|
+
fragment += '"';
|
|
1539
|
+
this.stringOpen = false;
|
|
1540
|
+
}
|
|
1541
|
+
fragment += this.ensureRoot();
|
|
1542
|
+
const commonDepth = this.findCommonStackDepth(targetSegments);
|
|
1543
|
+
fragment += this.closeDownTo(commonDepth);
|
|
1544
|
+
fragment += this.openDownTo(targetSegments, isArray ? 0 : "");
|
|
1545
|
+
return fragment;
|
|
1546
|
+
}
|
|
1496
1547
|
/**
|
|
1497
1548
|
* Returns the stack depth to preserve when navigating to a new target
|
|
1498
1549
|
* container path. Always >= 1 (the root is never popped).
|
|
@@ -2704,205 +2755,205 @@ function extractSources({
|
|
|
2704
2755
|
}
|
|
2705
2756
|
return sources.length > 0 ? sources : void 0;
|
|
2706
2757
|
}
|
|
2707
|
-
var getGroundingMetadataSchema = () =>
|
|
2708
|
-
webSearchQueries:
|
|
2709
|
-
imageSearchQueries:
|
|
2710
|
-
retrievalQueries:
|
|
2711
|
-
searchEntryPoint:
|
|
2712
|
-
groundingChunks:
|
|
2713
|
-
|
|
2714
|
-
web:
|
|
2715
|
-
image:
|
|
2716
|
-
sourceUri:
|
|
2717
|
-
imageUri:
|
|
2718
|
-
title:
|
|
2719
|
-
domain:
|
|
2758
|
+
var getGroundingMetadataSchema = () => z4.object({
|
|
2759
|
+
webSearchQueries: z4.array(z4.string()).nullish(),
|
|
2760
|
+
imageSearchQueries: z4.array(z4.string()).nullish(),
|
|
2761
|
+
retrievalQueries: z4.array(z4.string()).nullish(),
|
|
2762
|
+
searchEntryPoint: z4.object({ renderedContent: z4.string() }).nullish(),
|
|
2763
|
+
groundingChunks: z4.array(
|
|
2764
|
+
z4.object({
|
|
2765
|
+
web: z4.object({ uri: z4.string(), title: z4.string().nullish() }).nullish(),
|
|
2766
|
+
image: z4.object({
|
|
2767
|
+
sourceUri: z4.string(),
|
|
2768
|
+
imageUri: z4.string(),
|
|
2769
|
+
title: z4.string().nullish(),
|
|
2770
|
+
domain: z4.string().nullish()
|
|
2720
2771
|
}).nullish(),
|
|
2721
|
-
retrievedContext:
|
|
2722
|
-
uri:
|
|
2723
|
-
title:
|
|
2724
|
-
text:
|
|
2725
|
-
fileSearchStore:
|
|
2726
|
-
customMetadata:
|
|
2727
|
-
|
|
2728
|
-
key:
|
|
2729
|
-
stringValue:
|
|
2730
|
-
numericValue:
|
|
2731
|
-
stringListValue:
|
|
2772
|
+
retrievedContext: z4.object({
|
|
2773
|
+
uri: z4.string().nullish(),
|
|
2774
|
+
title: z4.string().nullish(),
|
|
2775
|
+
text: z4.string().nullish(),
|
|
2776
|
+
fileSearchStore: z4.string().nullish(),
|
|
2777
|
+
customMetadata: z4.array(
|
|
2778
|
+
z4.object({
|
|
2779
|
+
key: z4.string(),
|
|
2780
|
+
stringValue: z4.string().nullish(),
|
|
2781
|
+
numericValue: z4.number().nullish(),
|
|
2782
|
+
stringListValue: z4.object({ values: z4.array(z4.string()).nullish() }).nullish()
|
|
2732
2783
|
})
|
|
2733
2784
|
).nullish()
|
|
2734
2785
|
}).nullish(),
|
|
2735
|
-
maps:
|
|
2736
|
-
uri:
|
|
2737
|
-
title:
|
|
2738
|
-
text:
|
|
2739
|
-
placeId:
|
|
2786
|
+
maps: z4.object({
|
|
2787
|
+
uri: z4.string().nullish(),
|
|
2788
|
+
title: z4.string().nullish(),
|
|
2789
|
+
text: z4.string().nullish(),
|
|
2790
|
+
placeId: z4.string().nullish()
|
|
2740
2791
|
}).nullish()
|
|
2741
2792
|
})
|
|
2742
2793
|
).nullish(),
|
|
2743
|
-
groundingSupports:
|
|
2744
|
-
|
|
2745
|
-
segment:
|
|
2746
|
-
startIndex:
|
|
2747
|
-
endIndex:
|
|
2748
|
-
text:
|
|
2794
|
+
groundingSupports: z4.array(
|
|
2795
|
+
z4.object({
|
|
2796
|
+
segment: z4.object({
|
|
2797
|
+
startIndex: z4.number().nullish(),
|
|
2798
|
+
endIndex: z4.number().nullish(),
|
|
2799
|
+
text: z4.string().nullish()
|
|
2749
2800
|
}).nullish(),
|
|
2750
|
-
segment_text:
|
|
2751
|
-
groundingChunkIndices:
|
|
2752
|
-
supportChunkIndices:
|
|
2753
|
-
confidenceScores:
|
|
2754
|
-
confidenceScore:
|
|
2801
|
+
segment_text: z4.string().nullish(),
|
|
2802
|
+
groundingChunkIndices: z4.array(z4.number()).nullish(),
|
|
2803
|
+
supportChunkIndices: z4.array(z4.number()).nullish(),
|
|
2804
|
+
confidenceScores: z4.array(z4.number()).nullish(),
|
|
2805
|
+
confidenceScore: z4.array(z4.number()).nullish()
|
|
2755
2806
|
})
|
|
2756
2807
|
).nullish(),
|
|
2757
|
-
retrievalMetadata:
|
|
2758
|
-
|
|
2759
|
-
webDynamicRetrievalScore:
|
|
2808
|
+
retrievalMetadata: z4.union([
|
|
2809
|
+
z4.object({
|
|
2810
|
+
webDynamicRetrievalScore: z4.number()
|
|
2760
2811
|
}),
|
|
2761
|
-
|
|
2812
|
+
z4.object({})
|
|
2762
2813
|
]).nullish()
|
|
2763
2814
|
});
|
|
2764
|
-
var partialArgSchema = () =>
|
|
2765
|
-
jsonPath:
|
|
2766
|
-
stringValue:
|
|
2767
|
-
numberValue:
|
|
2768
|
-
boolValue:
|
|
2769
|
-
nullValue:
|
|
2770
|
-
willContinue:
|
|
2815
|
+
var partialArgSchema = () => z4.object({
|
|
2816
|
+
jsonPath: z4.string(),
|
|
2817
|
+
stringValue: z4.string().nullish(),
|
|
2818
|
+
numberValue: z4.number().nullish(),
|
|
2819
|
+
boolValue: z4.boolean().nullish(),
|
|
2820
|
+
nullValue: z4.unknown().nullish(),
|
|
2821
|
+
willContinue: z4.boolean().nullish()
|
|
2771
2822
|
});
|
|
2772
|
-
var getContentSchema = () =>
|
|
2773
|
-
parts:
|
|
2774
|
-
|
|
2823
|
+
var getContentSchema = () => z4.object({
|
|
2824
|
+
parts: z4.array(
|
|
2825
|
+
z4.union([
|
|
2775
2826
|
// note: order matters since text can be fully empty
|
|
2776
|
-
|
|
2777
|
-
functionCall:
|
|
2778
|
-
id:
|
|
2779
|
-
name:
|
|
2780
|
-
args:
|
|
2781
|
-
partialArgs:
|
|
2782
|
-
willContinue:
|
|
2827
|
+
z4.object({
|
|
2828
|
+
functionCall: z4.object({
|
|
2829
|
+
id: z4.string().nullish(),
|
|
2830
|
+
name: z4.string().nullish(),
|
|
2831
|
+
args: z4.unknown().nullish(),
|
|
2832
|
+
partialArgs: z4.array(partialArgSchema()).nullish(),
|
|
2833
|
+
willContinue: z4.boolean().nullish()
|
|
2783
2834
|
}),
|
|
2784
|
-
thoughtSignature:
|
|
2835
|
+
thoughtSignature: z4.string().nullish()
|
|
2785
2836
|
}),
|
|
2786
|
-
|
|
2787
|
-
inlineData:
|
|
2788
|
-
mimeType:
|
|
2789
|
-
data:
|
|
2837
|
+
z4.object({
|
|
2838
|
+
inlineData: z4.object({
|
|
2839
|
+
mimeType: z4.string(),
|
|
2840
|
+
data: z4.string()
|
|
2790
2841
|
}),
|
|
2791
|
-
thought:
|
|
2792
|
-
thoughtSignature:
|
|
2842
|
+
thought: z4.boolean().nullish(),
|
|
2843
|
+
thoughtSignature: z4.string().nullish()
|
|
2793
2844
|
}),
|
|
2794
|
-
|
|
2795
|
-
toolCall:
|
|
2796
|
-
toolType:
|
|
2797
|
-
args:
|
|
2798
|
-
id:
|
|
2845
|
+
z4.object({
|
|
2846
|
+
toolCall: z4.object({
|
|
2847
|
+
toolType: z4.string(),
|
|
2848
|
+
args: z4.unknown().nullish(),
|
|
2849
|
+
id: z4.string()
|
|
2799
2850
|
}),
|
|
2800
|
-
thoughtSignature:
|
|
2851
|
+
thoughtSignature: z4.string().nullish()
|
|
2801
2852
|
}),
|
|
2802
|
-
|
|
2803
|
-
toolResponse:
|
|
2804
|
-
toolType:
|
|
2805
|
-
response:
|
|
2806
|
-
id:
|
|
2853
|
+
z4.object({
|
|
2854
|
+
toolResponse: z4.object({
|
|
2855
|
+
toolType: z4.string(),
|
|
2856
|
+
response: z4.unknown().nullish(),
|
|
2857
|
+
id: z4.string()
|
|
2807
2858
|
}),
|
|
2808
|
-
thoughtSignature:
|
|
2859
|
+
thoughtSignature: z4.string().nullish()
|
|
2809
2860
|
}),
|
|
2810
|
-
|
|
2811
|
-
executableCode:
|
|
2812
|
-
language:
|
|
2813
|
-
code:
|
|
2861
|
+
z4.object({
|
|
2862
|
+
executableCode: z4.object({
|
|
2863
|
+
language: z4.string(),
|
|
2864
|
+
code: z4.string()
|
|
2814
2865
|
}).nullish(),
|
|
2815
|
-
codeExecutionResult:
|
|
2816
|
-
outcome:
|
|
2817
|
-
output:
|
|
2866
|
+
codeExecutionResult: z4.object({
|
|
2867
|
+
outcome: z4.string(),
|
|
2868
|
+
output: z4.string().nullish()
|
|
2818
2869
|
}).nullish(),
|
|
2819
|
-
text:
|
|
2820
|
-
thought:
|
|
2821
|
-
thoughtSignature:
|
|
2870
|
+
text: z4.string().nullish(),
|
|
2871
|
+
thought: z4.boolean().nullish(),
|
|
2872
|
+
thoughtSignature: z4.string().nullish()
|
|
2822
2873
|
})
|
|
2823
2874
|
])
|
|
2824
2875
|
).nullish()
|
|
2825
2876
|
});
|
|
2826
|
-
var getSafetyRatingSchema = () =>
|
|
2827
|
-
category:
|
|
2828
|
-
probability:
|
|
2829
|
-
probabilityScore:
|
|
2830
|
-
severity:
|
|
2831
|
-
severityScore:
|
|
2832
|
-
blocked:
|
|
2877
|
+
var getSafetyRatingSchema = () => z4.object({
|
|
2878
|
+
category: z4.string().nullish(),
|
|
2879
|
+
probability: z4.string().nullish(),
|
|
2880
|
+
probabilityScore: z4.number().nullish(),
|
|
2881
|
+
severity: z4.string().nullish(),
|
|
2882
|
+
severityScore: z4.number().nullish(),
|
|
2883
|
+
blocked: z4.boolean().nullish()
|
|
2833
2884
|
});
|
|
2834
|
-
var tokenDetailsSchema = () =>
|
|
2835
|
-
|
|
2836
|
-
modality:
|
|
2837
|
-
tokenCount:
|
|
2838
|
-
}).catchall(
|
|
2885
|
+
var tokenDetailsSchema = () => z4.array(
|
|
2886
|
+
z4.object({
|
|
2887
|
+
modality: z4.string(),
|
|
2888
|
+
tokenCount: z4.number()
|
|
2889
|
+
}).catchall(z4.json())
|
|
2839
2890
|
).nullish();
|
|
2840
|
-
var usageSchema = () =>
|
|
2841
|
-
cachedContentTokenCount:
|
|
2842
|
-
thoughtsTokenCount:
|
|
2843
|
-
promptTokenCount:
|
|
2844
|
-
candidatesTokenCount:
|
|
2845
|
-
toolUsePromptTokenCount:
|
|
2846
|
-
totalTokenCount:
|
|
2891
|
+
var usageSchema = () => z4.object({
|
|
2892
|
+
cachedContentTokenCount: z4.number().nullish(),
|
|
2893
|
+
thoughtsTokenCount: z4.number().nullish(),
|
|
2894
|
+
promptTokenCount: z4.number().nullish(),
|
|
2895
|
+
candidatesTokenCount: z4.number().nullish(),
|
|
2896
|
+
toolUsePromptTokenCount: z4.number().nullish(),
|
|
2897
|
+
totalTokenCount: z4.number().nullish(),
|
|
2847
2898
|
// https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType
|
|
2848
|
-
trafficType:
|
|
2849
|
-
serviceTier:
|
|
2899
|
+
trafficType: z4.string().nullish(),
|
|
2900
|
+
serviceTier: z4.string().nullish(),
|
|
2850
2901
|
// https://ai.google.dev/api/generate-content#Modality
|
|
2851
2902
|
promptTokensDetails: tokenDetailsSchema(),
|
|
2852
2903
|
cacheTokensDetails: tokenDetailsSchema(),
|
|
2853
2904
|
candidatesTokensDetails: tokenDetailsSchema(),
|
|
2854
2905
|
toolUsePromptTokensDetails: tokenDetailsSchema()
|
|
2855
|
-
}).catchall(
|
|
2856
|
-
var getUrlContextMetadataSchema = () =>
|
|
2857
|
-
urlMetadata:
|
|
2858
|
-
|
|
2859
|
-
retrievedUrl:
|
|
2860
|
-
urlRetrievalStatus:
|
|
2906
|
+
}).catchall(z4.json());
|
|
2907
|
+
var getUrlContextMetadataSchema = () => z4.object({
|
|
2908
|
+
urlMetadata: z4.array(
|
|
2909
|
+
z4.object({
|
|
2910
|
+
retrievedUrl: z4.string(),
|
|
2911
|
+
urlRetrievalStatus: z4.string()
|
|
2861
2912
|
})
|
|
2862
2913
|
).nullish()
|
|
2863
2914
|
});
|
|
2864
2915
|
var responseSchema = lazySchema3(
|
|
2865
2916
|
() => zodSchema3(
|
|
2866
|
-
|
|
2867
|
-
responseId:
|
|
2868
|
-
candidates:
|
|
2869
|
-
|
|
2870
|
-
content: getContentSchema().nullish().or(
|
|
2871
|
-
finishReason:
|
|
2872
|
-
finishMessage:
|
|
2873
|
-
continuationToken:
|
|
2874
|
-
safetyRatings:
|
|
2917
|
+
z4.object({
|
|
2918
|
+
responseId: z4.string().nullish(),
|
|
2919
|
+
candidates: z4.array(
|
|
2920
|
+
z4.object({
|
|
2921
|
+
content: getContentSchema().nullish().or(z4.object({}).strict()),
|
|
2922
|
+
finishReason: z4.string().nullish(),
|
|
2923
|
+
finishMessage: z4.string().nullish(),
|
|
2924
|
+
continuationToken: z4.string().nullish(),
|
|
2925
|
+
safetyRatings: z4.array(getSafetyRatingSchema()).nullish(),
|
|
2875
2926
|
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
|
2876
2927
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2877
2928
|
})
|
|
2878
2929
|
).nullish(),
|
|
2879
2930
|
usageMetadata: usageSchema().nullish(),
|
|
2880
|
-
promptFeedback:
|
|
2881
|
-
blockReason:
|
|
2882
|
-
safetyRatings:
|
|
2931
|
+
promptFeedback: z4.object({
|
|
2932
|
+
blockReason: z4.string().nullish(),
|
|
2933
|
+
safetyRatings: z4.array(getSafetyRatingSchema()).nullish()
|
|
2883
2934
|
}).nullish()
|
|
2884
2935
|
})
|
|
2885
2936
|
)
|
|
2886
2937
|
);
|
|
2887
2938
|
var chunkSchema = lazySchema3(
|
|
2888
2939
|
() => zodSchema3(
|
|
2889
|
-
|
|
2890
|
-
responseId:
|
|
2891
|
-
candidates:
|
|
2892
|
-
|
|
2940
|
+
z4.object({
|
|
2941
|
+
responseId: z4.string().nullish(),
|
|
2942
|
+
candidates: z4.array(
|
|
2943
|
+
z4.object({
|
|
2893
2944
|
content: getContentSchema().nullish(),
|
|
2894
|
-
finishReason:
|
|
2895
|
-
finishMessage:
|
|
2896
|
-
continuationToken:
|
|
2897
|
-
safetyRatings:
|
|
2945
|
+
finishReason: z4.string().nullish(),
|
|
2946
|
+
finishMessage: z4.string().nullish(),
|
|
2947
|
+
continuationToken: z4.string().nullish(),
|
|
2948
|
+
safetyRatings: z4.array(getSafetyRatingSchema()).nullish(),
|
|
2898
2949
|
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
|
2899
2950
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2900
2951
|
})
|
|
2901
2952
|
).nullish(),
|
|
2902
2953
|
usageMetadata: usageSchema().nullish(),
|
|
2903
|
-
promptFeedback:
|
|
2904
|
-
blockReason:
|
|
2905
|
-
safetyRatings:
|
|
2954
|
+
promptFeedback: z4.object({
|
|
2955
|
+
blockReason: z4.string().nullish(),
|
|
2956
|
+
safetyRatings: z4.array(getSafetyRatingSchema()).nullish()
|
|
2906
2957
|
}).nullish()
|
|
2907
2958
|
})
|
|
2908
2959
|
)
|
|
@@ -2913,16 +2964,16 @@ function isConfirmedPromptBlockReason(blockReason) {
|
|
|
2913
2964
|
|
|
2914
2965
|
// src/tool/code-execution.ts
|
|
2915
2966
|
import { createProviderToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
|
|
2916
|
-
import { z as
|
|
2967
|
+
import { z as z5 } from "zod/v4";
|
|
2917
2968
|
var codeExecution = createProviderToolFactoryWithOutputSchema({
|
|
2918
2969
|
id: "google.code_execution",
|
|
2919
|
-
inputSchema:
|
|
2920
|
-
language:
|
|
2921
|
-
code:
|
|
2970
|
+
inputSchema: z5.object({
|
|
2971
|
+
language: z5.string().describe("The programming language of the code."),
|
|
2972
|
+
code: z5.string().describe("The code to be executed.")
|
|
2922
2973
|
}),
|
|
2923
|
-
outputSchema:
|
|
2924
|
-
outcome:
|
|
2925
|
-
output:
|
|
2974
|
+
outputSchema: z5.object({
|
|
2975
|
+
outcome: z5.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
|
|
2976
|
+
output: z5.string().describe("The output from the code execution.")
|
|
2926
2977
|
})
|
|
2927
2978
|
});
|
|
2928
2979
|
|
|
@@ -2932,10 +2983,10 @@ import {
|
|
|
2932
2983
|
lazySchema as lazySchema4,
|
|
2933
2984
|
zodSchema as zodSchema4
|
|
2934
2985
|
} from "@ai-sdk/provider-utils";
|
|
2935
|
-
import { z as
|
|
2986
|
+
import { z as z6 } from "zod/v4";
|
|
2936
2987
|
var enterpriseWebSearch = createProviderToolFactory({
|
|
2937
2988
|
id: "google.enterprise_web_search",
|
|
2938
|
-
inputSchema: lazySchema4(() => zodSchema4(
|
|
2989
|
+
inputSchema: lazySchema4(() => zodSchema4(z6.object({})))
|
|
2939
2990
|
});
|
|
2940
2991
|
|
|
2941
2992
|
// src/tool/file-search.ts
|
|
@@ -2944,20 +2995,20 @@ import {
|
|
|
2944
2995
|
lazySchema as lazySchema5,
|
|
2945
2996
|
zodSchema as zodSchema5
|
|
2946
2997
|
} from "@ai-sdk/provider-utils";
|
|
2947
|
-
import { z as
|
|
2948
|
-
var fileSearchArgsBaseSchema = () =>
|
|
2998
|
+
import { z as z7 } from "zod/v4";
|
|
2999
|
+
var fileSearchArgsBaseSchema = () => z7.object({
|
|
2949
3000
|
/** The names of the file_search_stores to retrieve from.
|
|
2950
3001
|
* Example: `fileSearchStores/my-file-search-store-123`
|
|
2951
3002
|
*/
|
|
2952
|
-
fileSearchStoreNames:
|
|
3003
|
+
fileSearchStoreNames: z7.array(z7.string()).describe(
|
|
2953
3004
|
"The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
|
|
2954
3005
|
),
|
|
2955
3006
|
/** The number of file search retrieval chunks to retrieve. */
|
|
2956
|
-
topK:
|
|
3007
|
+
topK: z7.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
|
|
2957
3008
|
/** Metadata filter to apply to the file search retrieval documents.
|
|
2958
3009
|
* See https://google.aip.dev/160 for the syntax of the filter expression.
|
|
2959
3010
|
*/
|
|
2960
|
-
metadataFilter:
|
|
3011
|
+
metadataFilter: z7.string().describe(
|
|
2961
3012
|
"Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
|
|
2962
3013
|
).optional()
|
|
2963
3014
|
}).passthrough();
|
|
@@ -2975,10 +3026,10 @@ import {
|
|
|
2975
3026
|
lazySchema as lazySchema6,
|
|
2976
3027
|
zodSchema as zodSchema6
|
|
2977
3028
|
} from "@ai-sdk/provider-utils";
|
|
2978
|
-
import { z as
|
|
3029
|
+
import { z as z8 } from "zod/v4";
|
|
2979
3030
|
var googleMaps = createProviderToolFactory3({
|
|
2980
3031
|
id: "google.google_maps",
|
|
2981
|
-
inputSchema: lazySchema6(() => zodSchema6(
|
|
3032
|
+
inputSchema: lazySchema6(() => zodSchema6(z8.object({})))
|
|
2982
3033
|
});
|
|
2983
3034
|
|
|
2984
3035
|
// src/tool/google-search.ts
|
|
@@ -2987,15 +3038,15 @@ import {
|
|
|
2987
3038
|
lazySchema as lazySchema7,
|
|
2988
3039
|
zodSchema as zodSchema7
|
|
2989
3040
|
} from "@ai-sdk/provider-utils";
|
|
2990
|
-
import { z as
|
|
2991
|
-
var googleSearchToolArgsBaseSchema = () =>
|
|
2992
|
-
searchTypes:
|
|
2993
|
-
webSearch:
|
|
2994
|
-
imageSearch:
|
|
3041
|
+
import { z as z9 } from "zod/v4";
|
|
3042
|
+
var googleSearchToolArgsBaseSchema = () => z9.object({
|
|
3043
|
+
searchTypes: z9.object({
|
|
3044
|
+
webSearch: z9.object({}).optional(),
|
|
3045
|
+
imageSearch: z9.object({}).optional()
|
|
2995
3046
|
}).optional(),
|
|
2996
|
-
timeRangeFilter:
|
|
2997
|
-
startTime:
|
|
2998
|
-
endTime:
|
|
3047
|
+
timeRangeFilter: z9.object({
|
|
3048
|
+
startTime: z9.string(),
|
|
3049
|
+
endTime: z9.string()
|
|
2999
3050
|
}).optional()
|
|
3000
3051
|
}).passthrough();
|
|
3001
3052
|
var googleSearchToolArgsSchema = lazySchema7(
|
|
@@ -3014,20 +3065,20 @@ import {
|
|
|
3014
3065
|
lazySchema as lazySchema8,
|
|
3015
3066
|
zodSchema as zodSchema8
|
|
3016
3067
|
} from "@ai-sdk/provider-utils";
|
|
3017
|
-
import { z as
|
|
3068
|
+
import { z as z10 } from "zod/v4";
|
|
3018
3069
|
var urlContext = createProviderToolFactory5({
|
|
3019
3070
|
id: "google.url_context",
|
|
3020
|
-
inputSchema: lazySchema8(() => zodSchema8(
|
|
3071
|
+
inputSchema: lazySchema8(() => zodSchema8(z10.object({})))
|
|
3021
3072
|
});
|
|
3022
3073
|
|
|
3023
3074
|
// src/tool/vertex-rag-store.ts
|
|
3024
3075
|
import { createProviderToolFactory as createProviderToolFactory6 } from "@ai-sdk/provider-utils";
|
|
3025
|
-
import { z as
|
|
3076
|
+
import { z as z11 } from "zod/v4";
|
|
3026
3077
|
var vertexRagStore = createProviderToolFactory6({
|
|
3027
3078
|
id: "google.vertex_rag_store",
|
|
3028
|
-
inputSchema:
|
|
3029
|
-
ragCorpus:
|
|
3030
|
-
topK:
|
|
3079
|
+
inputSchema: z11.object({
|
|
3080
|
+
ragCorpus: z11.string(),
|
|
3081
|
+
topK: z11.number().optional()
|
|
3031
3082
|
})
|
|
3032
3083
|
});
|
|
3033
3084
|
|
|
@@ -4260,30 +4311,30 @@ import {
|
|
|
4260
4311
|
lazySchema as lazySchema9,
|
|
4261
4312
|
zodSchema as zodSchema9
|
|
4262
4313
|
} from "@ai-sdk/provider-utils";
|
|
4263
|
-
import { z as
|
|
4264
|
-
var tokenByModalitySchema = () =>
|
|
4265
|
-
modality:
|
|
4266
|
-
tokens:
|
|
4314
|
+
import { z as z12 } from "zod/v4";
|
|
4315
|
+
var tokenByModalitySchema = () => z12.object({
|
|
4316
|
+
modality: z12.string().nullish(),
|
|
4317
|
+
tokens: z12.number().nullish()
|
|
4267
4318
|
}).loose();
|
|
4268
|
-
var usageSchema2 = () =>
|
|
4269
|
-
total_input_tokens:
|
|
4270
|
-
total_output_tokens:
|
|
4271
|
-
total_thought_tokens:
|
|
4272
|
-
total_cached_tokens:
|
|
4273
|
-
total_tool_use_tokens:
|
|
4274
|
-
total_tokens:
|
|
4275
|
-
input_tokens_by_modality:
|
|
4276
|
-
output_tokens_by_modality:
|
|
4277
|
-
cached_tokens_by_modality:
|
|
4278
|
-
tool_use_tokens_by_modality:
|
|
4279
|
-
grounding_tool_count:
|
|
4280
|
-
|
|
4281
|
-
type:
|
|
4282
|
-
count:
|
|
4319
|
+
var usageSchema2 = () => z12.object({
|
|
4320
|
+
total_input_tokens: z12.number().nullish(),
|
|
4321
|
+
total_output_tokens: z12.number().nullish(),
|
|
4322
|
+
total_thought_tokens: z12.number().nullish(),
|
|
4323
|
+
total_cached_tokens: z12.number().nullish(),
|
|
4324
|
+
total_tool_use_tokens: z12.number().nullish(),
|
|
4325
|
+
total_tokens: z12.number().nullish(),
|
|
4326
|
+
input_tokens_by_modality: z12.array(tokenByModalitySchema()).nullish(),
|
|
4327
|
+
output_tokens_by_modality: z12.array(tokenByModalitySchema()).nullish(),
|
|
4328
|
+
cached_tokens_by_modality: z12.array(tokenByModalitySchema()).nullish(),
|
|
4329
|
+
tool_use_tokens_by_modality: z12.array(tokenByModalitySchema()).nullish(),
|
|
4330
|
+
grounding_tool_count: z12.array(
|
|
4331
|
+
z12.object({
|
|
4332
|
+
type: z12.string().nullish(),
|
|
4333
|
+
count: z12.number().nullish()
|
|
4283
4334
|
}).loose()
|
|
4284
4335
|
).nullish()
|
|
4285
4336
|
}).loose();
|
|
4286
|
-
var interactionStatusSchema = () =>
|
|
4337
|
+
var interactionStatusSchema = () => z12.enum([
|
|
4287
4338
|
"in_progress",
|
|
4288
4339
|
"requires_action",
|
|
4289
4340
|
"completed",
|
|
@@ -4292,69 +4343,69 @@ var interactionStatusSchema = () => z11.enum([
|
|
|
4292
4343
|
"incomplete"
|
|
4293
4344
|
]);
|
|
4294
4345
|
var annotationSchema = () => {
|
|
4295
|
-
const urlCitation =
|
|
4296
|
-
type:
|
|
4297
|
-
url:
|
|
4298
|
-
title:
|
|
4299
|
-
start_index:
|
|
4300
|
-
end_index:
|
|
4346
|
+
const urlCitation = z12.object({
|
|
4347
|
+
type: z12.literal("url_citation"),
|
|
4348
|
+
url: z12.string().nullish(),
|
|
4349
|
+
title: z12.string().nullish(),
|
|
4350
|
+
start_index: z12.number().nullish(),
|
|
4351
|
+
end_index: z12.number().nullish()
|
|
4301
4352
|
}).loose();
|
|
4302
|
-
const fileCitation =
|
|
4303
|
-
type:
|
|
4304
|
-
file_name:
|
|
4305
|
-
document_uri:
|
|
4306
|
-
url:
|
|
4307
|
-
page_number:
|
|
4308
|
-
media_id:
|
|
4309
|
-
start_index:
|
|
4310
|
-
end_index:
|
|
4311
|
-
custom_metadata:
|
|
4353
|
+
const fileCitation = z12.object({
|
|
4354
|
+
type: z12.literal("file_citation"),
|
|
4355
|
+
file_name: z12.string().nullish(),
|
|
4356
|
+
document_uri: z12.string().nullish(),
|
|
4357
|
+
url: z12.string().nullish(),
|
|
4358
|
+
page_number: z12.number().nullish(),
|
|
4359
|
+
media_id: z12.string().nullish(),
|
|
4360
|
+
start_index: z12.number().nullish(),
|
|
4361
|
+
end_index: z12.number().nullish(),
|
|
4362
|
+
custom_metadata: z12.record(z12.string(), z12.unknown()).nullish()
|
|
4312
4363
|
}).loose();
|
|
4313
|
-
const placeCitation =
|
|
4314
|
-
type:
|
|
4315
|
-
name:
|
|
4316
|
-
url:
|
|
4317
|
-
place_id:
|
|
4318
|
-
start_index:
|
|
4319
|
-
end_index:
|
|
4364
|
+
const placeCitation = z12.object({
|
|
4365
|
+
type: z12.literal("place_citation"),
|
|
4366
|
+
name: z12.string().nullish(),
|
|
4367
|
+
url: z12.string().nullish(),
|
|
4368
|
+
place_id: z12.string().nullish(),
|
|
4369
|
+
start_index: z12.number().nullish(),
|
|
4370
|
+
end_index: z12.number().nullish()
|
|
4320
4371
|
}).loose();
|
|
4321
|
-
return
|
|
4372
|
+
return z12.union([
|
|
4322
4373
|
urlCitation,
|
|
4323
4374
|
fileCitation,
|
|
4324
4375
|
placeCitation,
|
|
4325
|
-
|
|
4376
|
+
z12.object({ type: z12.string() }).loose()
|
|
4326
4377
|
]);
|
|
4327
4378
|
};
|
|
4328
|
-
var thoughtSummaryItemSchema = () =>
|
|
4329
|
-
type:
|
|
4330
|
-
text:
|
|
4331
|
-
data:
|
|
4332
|
-
mime_type:
|
|
4379
|
+
var thoughtSummaryItemSchema = () => z12.object({
|
|
4380
|
+
type: z12.string(),
|
|
4381
|
+
text: z12.string().nullish(),
|
|
4382
|
+
data: z12.string().nullish(),
|
|
4383
|
+
mime_type: z12.string().nullish()
|
|
4333
4384
|
}).loose();
|
|
4334
4385
|
var contentBlockSchema = () => {
|
|
4335
|
-
const textContent =
|
|
4336
|
-
type:
|
|
4337
|
-
text:
|
|
4338
|
-
annotations:
|
|
4386
|
+
const textContent = z12.object({
|
|
4387
|
+
type: z12.literal("text"),
|
|
4388
|
+
text: z12.string(),
|
|
4389
|
+
annotations: z12.array(annotationSchema()).nullish()
|
|
4339
4390
|
}).loose();
|
|
4340
|
-
const imageContent =
|
|
4341
|
-
type:
|
|
4342
|
-
data:
|
|
4343
|
-
mime_type:
|
|
4344
|
-
resolution:
|
|
4345
|
-
uri:
|
|
4391
|
+
const imageContent = z12.object({
|
|
4392
|
+
type: z12.literal("image"),
|
|
4393
|
+
data: z12.string().nullish(),
|
|
4394
|
+
mime_type: z12.string().nullish(),
|
|
4395
|
+
resolution: z12.enum(["low", "medium", "high", "ultra_high"]).nullish(),
|
|
4396
|
+
uri: z12.string().nullish()
|
|
4346
4397
|
}).loose();
|
|
4347
|
-
const videoContent =
|
|
4348
|
-
type:
|
|
4349
|
-
data:
|
|
4350
|
-
mime_type:
|
|
4351
|
-
uri:
|
|
4398
|
+
const videoContent = z12.object({
|
|
4399
|
+
type: z12.literal("video"),
|
|
4400
|
+
data: z12.string().nullish(),
|
|
4401
|
+
mime_type: z12.string().nullish(),
|
|
4402
|
+
uri: z12.string().nullish()
|
|
4352
4403
|
}).loose();
|
|
4353
|
-
return
|
|
4404
|
+
return z12.union([
|
|
4354
4405
|
textContent,
|
|
4355
4406
|
imageContent,
|
|
4356
4407
|
videoContent,
|
|
4357
|
-
|
|
4408
|
+
z12.object({ type: z12.string() }).loose()
|
|
4358
4409
|
]);
|
|
4359
4410
|
};
|
|
4360
4411
|
var BUILTIN_TOOL_CALL_STEP_TYPES = [
|
|
@@ -4374,73 +4425,73 @@ var BUILTIN_TOOL_RESULT_STEP_TYPES = [
|
|
|
4374
4425
|
"mcp_server_tool_result"
|
|
4375
4426
|
];
|
|
4376
4427
|
var stepSchema = () => {
|
|
4377
|
-
const userInputStep =
|
|
4378
|
-
type:
|
|
4379
|
-
content:
|
|
4428
|
+
const userInputStep = z12.object({
|
|
4429
|
+
type: z12.literal("user_input"),
|
|
4430
|
+
content: z12.array(contentBlockSchema()).nullish()
|
|
4380
4431
|
}).loose();
|
|
4381
|
-
const modelOutputStep =
|
|
4382
|
-
type:
|
|
4383
|
-
content:
|
|
4432
|
+
const modelOutputStep = z12.object({
|
|
4433
|
+
type: z12.literal("model_output"),
|
|
4434
|
+
content: z12.array(contentBlockSchema()).nullish()
|
|
4384
4435
|
}).loose();
|
|
4385
|
-
const functionCallStep =
|
|
4386
|
-
type:
|
|
4387
|
-
id:
|
|
4388
|
-
name:
|
|
4389
|
-
arguments:
|
|
4390
|
-
signature:
|
|
4436
|
+
const functionCallStep = z12.object({
|
|
4437
|
+
type: z12.literal("function_call"),
|
|
4438
|
+
id: z12.string(),
|
|
4439
|
+
name: z12.string(),
|
|
4440
|
+
arguments: z12.record(z12.string(), z12.unknown()).nullish(),
|
|
4441
|
+
signature: z12.string().nullish()
|
|
4391
4442
|
}).loose();
|
|
4392
|
-
const thoughtStep =
|
|
4393
|
-
type:
|
|
4394
|
-
signature:
|
|
4395
|
-
summary:
|
|
4443
|
+
const thoughtStep = z12.object({
|
|
4444
|
+
type: z12.literal("thought"),
|
|
4445
|
+
signature: z12.string().nullish(),
|
|
4446
|
+
summary: z12.array(thoughtSummaryItemSchema()).nullish()
|
|
4396
4447
|
}).loose();
|
|
4397
|
-
const builtinToolCallStep =
|
|
4398
|
-
type:
|
|
4399
|
-
id:
|
|
4400
|
-
arguments:
|
|
4401
|
-
name:
|
|
4402
|
-
server_name:
|
|
4403
|
-
search_type:
|
|
4404
|
-
signature:
|
|
4448
|
+
const builtinToolCallStep = z12.object({
|
|
4449
|
+
type: z12.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
|
|
4450
|
+
id: z12.string(),
|
|
4451
|
+
arguments: z12.record(z12.string(), z12.unknown()).nullish(),
|
|
4452
|
+
name: z12.string().nullish(),
|
|
4453
|
+
server_name: z12.string().nullish(),
|
|
4454
|
+
search_type: z12.string().nullish(),
|
|
4455
|
+
signature: z12.string().nullish()
|
|
4405
4456
|
}).loose();
|
|
4406
|
-
const builtinToolResultStep =
|
|
4407
|
-
type:
|
|
4408
|
-
call_id:
|
|
4409
|
-
result:
|
|
4410
|
-
is_error:
|
|
4411
|
-
name:
|
|
4412
|
-
server_name:
|
|
4413
|
-
signature:
|
|
4457
|
+
const builtinToolResultStep = z12.object({
|
|
4458
|
+
type: z12.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
|
|
4459
|
+
call_id: z12.string(),
|
|
4460
|
+
result: z12.unknown().nullish(),
|
|
4461
|
+
is_error: z12.boolean().nullish(),
|
|
4462
|
+
name: z12.string().nullish(),
|
|
4463
|
+
server_name: z12.string().nullish(),
|
|
4464
|
+
signature: z12.string().nullish()
|
|
4414
4465
|
}).loose();
|
|
4415
|
-
return
|
|
4466
|
+
return z12.union([
|
|
4416
4467
|
userInputStep,
|
|
4417
4468
|
modelOutputStep,
|
|
4418
4469
|
functionCallStep,
|
|
4419
4470
|
thoughtStep,
|
|
4420
4471
|
builtinToolCallStep,
|
|
4421
4472
|
builtinToolResultStep,
|
|
4422
|
-
|
|
4473
|
+
z12.object({ type: z12.string() }).loose()
|
|
4423
4474
|
]);
|
|
4424
4475
|
};
|
|
4425
4476
|
var googleInteractionsResponseSchema = lazySchema9(
|
|
4426
4477
|
() => zodSchema9(
|
|
4427
|
-
|
|
4478
|
+
z12.object({
|
|
4428
4479
|
/*
|
|
4429
4480
|
* `id` is omitted from the response body when `store: false` (fully
|
|
4430
4481
|
* stateless mode) — there is no server-side interaction record for the
|
|
4431
4482
|
* client to reference. `nullish` lets the schema accept that shape.
|
|
4432
4483
|
*/
|
|
4433
|
-
id:
|
|
4434
|
-
created:
|
|
4435
|
-
updated:
|
|
4484
|
+
id: z12.string().nullish(),
|
|
4485
|
+
created: z12.string().nullish(),
|
|
4486
|
+
updated: z12.string().nullish(),
|
|
4436
4487
|
status: interactionStatusSchema(),
|
|
4437
|
-
model:
|
|
4438
|
-
agent:
|
|
4439
|
-
steps:
|
|
4488
|
+
model: z12.string().nullish(),
|
|
4489
|
+
agent: z12.string().nullish(),
|
|
4490
|
+
steps: z12.array(stepSchema()).nullish(),
|
|
4440
4491
|
usage: usageSchema2().nullish(),
|
|
4441
|
-
service_tier:
|
|
4442
|
-
previous_interaction_id:
|
|
4443
|
-
response_modalities:
|
|
4492
|
+
service_tier: z12.string().nullish(),
|
|
4493
|
+
previous_interaction_id: z12.string().nullish(),
|
|
4494
|
+
response_modalities: z12.array(z12.string()).nullish()
|
|
4444
4495
|
}).loose()
|
|
4445
4496
|
)
|
|
4446
4497
|
);
|
|
@@ -4450,82 +4501,82 @@ var googleInteractionsEventSchema = lazySchema9(
|
|
|
4450
4501
|
const status = interactionStatusSchema();
|
|
4451
4502
|
const annotation = annotationSchema();
|
|
4452
4503
|
const thoughtSummaryItem = thoughtSummaryItemSchema();
|
|
4453
|
-
const interactionCreatedEvent =
|
|
4454
|
-
event_type:
|
|
4455
|
-
event_id:
|
|
4456
|
-
interaction:
|
|
4504
|
+
const interactionCreatedEvent = z12.object({
|
|
4505
|
+
event_type: z12.literal("interaction.created"),
|
|
4506
|
+
event_id: z12.string().nullish(),
|
|
4507
|
+
interaction: z12.object({
|
|
4457
4508
|
/*
|
|
4458
4509
|
* `id` is omitted when `store: false` (fully stateless mode);
|
|
4459
4510
|
* see the matching note on `googleInteractionsResponseSchema.id`.
|
|
4460
4511
|
*/
|
|
4461
|
-
id:
|
|
4462
|
-
created:
|
|
4463
|
-
model:
|
|
4464
|
-
agent:
|
|
4512
|
+
id: z12.string().nullish(),
|
|
4513
|
+
created: z12.string().nullish(),
|
|
4514
|
+
model: z12.string().nullish(),
|
|
4515
|
+
agent: z12.string().nullish(),
|
|
4465
4516
|
status: status.nullish()
|
|
4466
4517
|
}).loose()
|
|
4467
4518
|
}).loose();
|
|
4468
|
-
const stepStartEvent =
|
|
4469
|
-
event_type:
|
|
4470
|
-
event_id:
|
|
4471
|
-
index:
|
|
4519
|
+
const stepStartEvent = z12.object({
|
|
4520
|
+
event_type: z12.literal("step.start"),
|
|
4521
|
+
event_id: z12.string().nullish(),
|
|
4522
|
+
index: z12.number(),
|
|
4472
4523
|
step: stepSchema()
|
|
4473
4524
|
}).loose();
|
|
4474
|
-
const stepDeltaText =
|
|
4475
|
-
type:
|
|
4476
|
-
text:
|
|
4525
|
+
const stepDeltaText = z12.object({
|
|
4526
|
+
type: z12.literal("text"),
|
|
4527
|
+
text: z12.string()
|
|
4477
4528
|
}).loose();
|
|
4478
|
-
const stepDeltaThoughtSummary =
|
|
4479
|
-
type:
|
|
4529
|
+
const stepDeltaThoughtSummary = z12.object({
|
|
4530
|
+
type: z12.literal("thought_summary"),
|
|
4480
4531
|
content: thoughtSummaryItem.nullish()
|
|
4481
4532
|
}).loose();
|
|
4482
|
-
const stepDeltaThoughtSignature =
|
|
4483
|
-
type:
|
|
4484
|
-
signature:
|
|
4533
|
+
const stepDeltaThoughtSignature = z12.object({
|
|
4534
|
+
type: z12.literal("thought_signature"),
|
|
4535
|
+
signature: z12.string().nullish()
|
|
4485
4536
|
}).loose();
|
|
4486
|
-
const stepDeltaArgumentsDelta =
|
|
4487
|
-
type:
|
|
4488
|
-
arguments:
|
|
4489
|
-
id:
|
|
4490
|
-
signature:
|
|
4537
|
+
const stepDeltaArgumentsDelta = z12.object({
|
|
4538
|
+
type: z12.literal("arguments_delta"),
|
|
4539
|
+
arguments: z12.string().nullish(),
|
|
4540
|
+
id: z12.string().nullish(),
|
|
4541
|
+
signature: z12.string().nullish()
|
|
4491
4542
|
}).loose();
|
|
4492
|
-
const stepDeltaTextAnnotation =
|
|
4493
|
-
type:
|
|
4494
|
-
annotations:
|
|
4543
|
+
const stepDeltaTextAnnotation = z12.object({
|
|
4544
|
+
type: z12.enum(["text_annotation_delta", "text_annotation"]),
|
|
4545
|
+
annotations: z12.array(annotation).nullish()
|
|
4495
4546
|
}).loose();
|
|
4496
|
-
const stepDeltaImage =
|
|
4497
|
-
type:
|
|
4498
|
-
data:
|
|
4499
|
-
mime_type:
|
|
4500
|
-
resolution:
|
|
4501
|
-
uri:
|
|
4547
|
+
const stepDeltaImage = z12.object({
|
|
4548
|
+
type: z12.literal("image"),
|
|
4549
|
+
data: z12.string().nullish(),
|
|
4550
|
+
mime_type: z12.string().nullish(),
|
|
4551
|
+
resolution: z12.enum(["low", "medium", "high", "ultra_high"]).nullish(),
|
|
4552
|
+
uri: z12.string().nullish()
|
|
4502
4553
|
}).loose();
|
|
4503
|
-
const stepDeltaVideo =
|
|
4504
|
-
type:
|
|
4505
|
-
data:
|
|
4506
|
-
mime_type:
|
|
4507
|
-
uri:
|
|
4554
|
+
const stepDeltaVideo = z12.object({
|
|
4555
|
+
type: z12.literal("video"),
|
|
4556
|
+
data: z12.string().nullish(),
|
|
4557
|
+
mime_type: z12.string().nullish(),
|
|
4558
|
+
uri: z12.string().nullish()
|
|
4508
4559
|
}).loose();
|
|
4509
|
-
const stepDeltaBuiltinToolCall =
|
|
4510
|
-
type:
|
|
4511
|
-
id:
|
|
4512
|
-
arguments:
|
|
4513
|
-
name:
|
|
4514
|
-
server_name:
|
|
4515
|
-
search_type:
|
|
4516
|
-
signature:
|
|
4560
|
+
const stepDeltaBuiltinToolCall = z12.object({
|
|
4561
|
+
type: z12.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
|
|
4562
|
+
id: z12.string().nullish(),
|
|
4563
|
+
arguments: z12.record(z12.string(), z12.unknown()).nullish(),
|
|
4564
|
+
name: z12.string().nullish(),
|
|
4565
|
+
server_name: z12.string().nullish(),
|
|
4566
|
+
search_type: z12.string().nullish(),
|
|
4567
|
+
signature: z12.string().nullish()
|
|
4517
4568
|
}).loose();
|
|
4518
|
-
const stepDeltaBuiltinToolResult =
|
|
4519
|
-
type:
|
|
4520
|
-
call_id:
|
|
4521
|
-
result:
|
|
4522
|
-
is_error:
|
|
4523
|
-
name:
|
|
4524
|
-
server_name:
|
|
4525
|
-
signature:
|
|
4569
|
+
const stepDeltaBuiltinToolResult = z12.object({
|
|
4570
|
+
type: z12.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
|
|
4571
|
+
call_id: z12.string().nullish(),
|
|
4572
|
+
result: z12.unknown().nullish(),
|
|
4573
|
+
is_error: z12.boolean().nullish(),
|
|
4574
|
+
name: z12.string().nullish(),
|
|
4575
|
+
server_name: z12.string().nullish(),
|
|
4576
|
+
signature: z12.string().nullish()
|
|
4526
4577
|
}).loose();
|
|
4527
|
-
const stepDeltaUnknown =
|
|
4528
|
-
const stepDeltaUnion =
|
|
4578
|
+
const stepDeltaUnknown = z12.object({ type: z12.string() }).loose();
|
|
4579
|
+
const stepDeltaUnion = z12.union([
|
|
4529
4580
|
stepDeltaText,
|
|
4530
4581
|
stepDeltaImage,
|
|
4531
4582
|
stepDeltaVideo,
|
|
@@ -4537,55 +4588,55 @@ var googleInteractionsEventSchema = lazySchema9(
|
|
|
4537
4588
|
stepDeltaBuiltinToolResult,
|
|
4538
4589
|
stepDeltaUnknown
|
|
4539
4590
|
]);
|
|
4540
|
-
const stepDeltaEvent =
|
|
4541
|
-
event_type:
|
|
4542
|
-
event_id:
|
|
4543
|
-
index:
|
|
4591
|
+
const stepDeltaEvent = z12.object({
|
|
4592
|
+
event_type: z12.literal("step.delta"),
|
|
4593
|
+
event_id: z12.string().nullish(),
|
|
4594
|
+
index: z12.number(),
|
|
4544
4595
|
delta: stepDeltaUnion
|
|
4545
4596
|
}).loose();
|
|
4546
|
-
const stepStopEvent =
|
|
4547
|
-
event_type:
|
|
4548
|
-
event_id:
|
|
4549
|
-
index:
|
|
4597
|
+
const stepStopEvent = z12.object({
|
|
4598
|
+
event_type: z12.literal("step.stop"),
|
|
4599
|
+
event_id: z12.string().nullish(),
|
|
4600
|
+
index: z12.number()
|
|
4550
4601
|
}).loose();
|
|
4551
|
-
const interactionStatusUpdateEvent =
|
|
4552
|
-
event_type:
|
|
4553
|
-
event_id:
|
|
4554
|
-
interaction_id:
|
|
4602
|
+
const interactionStatusUpdateEvent = z12.object({
|
|
4603
|
+
event_type: z12.literal("interaction.status_update"),
|
|
4604
|
+
event_id: z12.string().nullish(),
|
|
4605
|
+
interaction_id: z12.string().nullish(),
|
|
4555
4606
|
status: status.nullish()
|
|
4556
4607
|
}).loose();
|
|
4557
|
-
const interactionInProgressEvent =
|
|
4558
|
-
event_type:
|
|
4559
|
-
event_id:
|
|
4560
|
-
interaction_id:
|
|
4608
|
+
const interactionInProgressEvent = z12.object({
|
|
4609
|
+
event_type: z12.literal("interaction.in_progress"),
|
|
4610
|
+
event_id: z12.string().nullish(),
|
|
4611
|
+
interaction_id: z12.string().nullish(),
|
|
4561
4612
|
status: status.nullish()
|
|
4562
4613
|
}).loose();
|
|
4563
|
-
const interactionRequiresActionEvent =
|
|
4564
|
-
event_type:
|
|
4565
|
-
event_id:
|
|
4566
|
-
interaction_id:
|
|
4614
|
+
const interactionRequiresActionEvent = z12.object({
|
|
4615
|
+
event_type: z12.literal("interaction.requires_action"),
|
|
4616
|
+
event_id: z12.string().nullish(),
|
|
4617
|
+
interaction_id: z12.string().nullish(),
|
|
4567
4618
|
status: status.nullish()
|
|
4568
4619
|
}).loose();
|
|
4569
|
-
const interactionCompletedEvent =
|
|
4570
|
-
event_type:
|
|
4571
|
-
event_id:
|
|
4572
|
-
interaction:
|
|
4573
|
-
id:
|
|
4620
|
+
const interactionCompletedEvent = z12.object({
|
|
4621
|
+
event_type: z12.literal("interaction.completed"),
|
|
4622
|
+
event_id: z12.string().nullish(),
|
|
4623
|
+
interaction: z12.object({
|
|
4624
|
+
id: z12.string().nullish(),
|
|
4574
4625
|
status: status.nullish(),
|
|
4575
4626
|
usage: usageSchema2().nullish(),
|
|
4576
|
-
service_tier:
|
|
4627
|
+
service_tier: z12.string().nullish()
|
|
4577
4628
|
}).loose()
|
|
4578
4629
|
}).loose();
|
|
4579
|
-
const errorEvent =
|
|
4580
|
-
event_type:
|
|
4581
|
-
event_id:
|
|
4582
|
-
error:
|
|
4583
|
-
code:
|
|
4584
|
-
message:
|
|
4630
|
+
const errorEvent = z12.object({
|
|
4631
|
+
event_type: z12.literal("error"),
|
|
4632
|
+
event_id: z12.string().nullish(),
|
|
4633
|
+
error: z12.object({
|
|
4634
|
+
code: z12.string().nullish(),
|
|
4635
|
+
message: z12.string().nullish()
|
|
4585
4636
|
}).loose().nullish()
|
|
4586
4637
|
}).loose();
|
|
4587
|
-
const unknownEvent =
|
|
4588
|
-
return
|
|
4638
|
+
const unknownEvent = z12.object({ event_type: z12.string() }).loose();
|
|
4639
|
+
return z12.union([
|
|
4589
4640
|
interactionCreatedEvent,
|
|
4590
4641
|
stepStartEvent,
|
|
4591
4642
|
stepDeltaEvent,
|
|
@@ -4606,26 +4657,26 @@ import {
|
|
|
4606
4657
|
lazySchema as lazySchema10,
|
|
4607
4658
|
zodSchema as zodSchema10
|
|
4608
4659
|
} from "@ai-sdk/provider-utils";
|
|
4609
|
-
import { z as
|
|
4660
|
+
import { z as z13 } from "zod/v4";
|
|
4610
4661
|
var googleInteractionsLanguageModelOptions = lazySchema10(
|
|
4611
4662
|
() => zodSchema10(
|
|
4612
|
-
|
|
4613
|
-
previousInteractionId:
|
|
4614
|
-
store:
|
|
4615
|
-
agent:
|
|
4616
|
-
agentConfig:
|
|
4617
|
-
|
|
4618
|
-
type:
|
|
4663
|
+
z13.object({
|
|
4664
|
+
previousInteractionId: z13.string().nullish(),
|
|
4665
|
+
store: z13.boolean().nullish(),
|
|
4666
|
+
agent: z13.string().nullish(),
|
|
4667
|
+
agentConfig: z13.union([
|
|
4668
|
+
z13.object({
|
|
4669
|
+
type: z13.literal("dynamic")
|
|
4619
4670
|
}).loose(),
|
|
4620
|
-
|
|
4621
|
-
type:
|
|
4622
|
-
thinkingSummaries:
|
|
4623
|
-
visualization:
|
|
4624
|
-
collaborativePlanning:
|
|
4671
|
+
z13.object({
|
|
4672
|
+
type: z13.literal("deep-research"),
|
|
4673
|
+
thinkingSummaries: z13.enum(["auto", "none"]).nullish(),
|
|
4674
|
+
visualization: z13.enum(["off", "auto"]).nullish(),
|
|
4675
|
+
collaborativePlanning: z13.boolean().nullish()
|
|
4625
4676
|
})
|
|
4626
4677
|
]).nullish(),
|
|
4627
|
-
thinkingLevel:
|
|
4628
|
-
thinkingSummaries:
|
|
4678
|
+
thinkingLevel: z13.enum(["minimal", "low", "medium", "high"]).nullish(),
|
|
4679
|
+
thinkingSummaries: z13.enum(["auto", "none"]).nullish(),
|
|
4629
4680
|
/**
|
|
4630
4681
|
* Output-format entries that map directly to the API's `response_format`
|
|
4631
4682
|
* array. Use this to request image, audio, video, or non-JSON text
|
|
@@ -4635,17 +4686,17 @@ var googleInteractionsLanguageModelOptions = lazySchema10(
|
|
|
4635
4686
|
* type: 'json', schema }` still drives JSON-mode and adds a matching
|
|
4636
4687
|
* text entry automatically; entries listed here are appended.
|
|
4637
4688
|
*/
|
|
4638
|
-
responseFormat:
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
type:
|
|
4642
|
-
mimeType:
|
|
4643
|
-
schema:
|
|
4689
|
+
responseFormat: z13.array(
|
|
4690
|
+
z13.union([
|
|
4691
|
+
z13.object({
|
|
4692
|
+
type: z13.literal("text"),
|
|
4693
|
+
mimeType: z13.string().nullish(),
|
|
4694
|
+
schema: z13.unknown().nullish()
|
|
4644
4695
|
}).loose(),
|
|
4645
|
-
|
|
4646
|
-
type:
|
|
4647
|
-
mimeType:
|
|
4648
|
-
aspectRatio:
|
|
4696
|
+
z13.object({
|
|
4697
|
+
type: z13.literal("image"),
|
|
4698
|
+
mimeType: z13.string().nullish(),
|
|
4699
|
+
aspectRatio: z13.enum([
|
|
4649
4700
|
"1:1",
|
|
4650
4701
|
"2:3",
|
|
4651
4702
|
"3:2",
|
|
@@ -4661,19 +4712,19 @@ var googleInteractionsLanguageModelOptions = lazySchema10(
|
|
|
4661
4712
|
"1:4",
|
|
4662
4713
|
"4:1"
|
|
4663
4714
|
]).nullish(),
|
|
4664
|
-
imageSize:
|
|
4715
|
+
imageSize: z13.enum(["1K", "2K", "4K", "512"]).nullish()
|
|
4665
4716
|
}).loose(),
|
|
4666
|
-
|
|
4667
|
-
type:
|
|
4668
|
-
mimeType:
|
|
4717
|
+
z13.object({
|
|
4718
|
+
type: z13.literal("audio"),
|
|
4719
|
+
mimeType: z13.string().nullish()
|
|
4669
4720
|
}).loose(),
|
|
4670
|
-
|
|
4671
|
-
type:
|
|
4672
|
-
aspectRatio:
|
|
4673
|
-
resolution:
|
|
4674
|
-
duration:
|
|
4675
|
-
delivery:
|
|
4676
|
-
gcsUri:
|
|
4721
|
+
z13.object({
|
|
4722
|
+
type: z13.literal("video"),
|
|
4723
|
+
aspectRatio: z13.enum(["16:9", "9:16"]).nullish(),
|
|
4724
|
+
resolution: z13.enum(["360p", "720p", "1080p", "4k"]).nullish(),
|
|
4725
|
+
duration: z13.string().nullish(),
|
|
4726
|
+
delivery: z13.enum(["inline", "uri"]).nullish(),
|
|
4727
|
+
gcsUri: z13.string().nullish()
|
|
4677
4728
|
}).loose()
|
|
4678
4729
|
])
|
|
4679
4730
|
).nullish(),
|
|
@@ -4683,8 +4734,8 @@ var googleInteractionsLanguageModelOptions = lazySchema10(
|
|
|
4683
4734
|
* translates it into a matching `response_format` image entry and
|
|
4684
4735
|
* emits a warning when set.
|
|
4685
4736
|
*/
|
|
4686
|
-
imageConfig:
|
|
4687
|
-
aspectRatio:
|
|
4737
|
+
imageConfig: z13.object({
|
|
4738
|
+
aspectRatio: z13.enum([
|
|
4688
4739
|
"1:1",
|
|
4689
4740
|
"2:3",
|
|
4690
4741
|
"3:2",
|
|
@@ -4700,35 +4751,35 @@ var googleInteractionsLanguageModelOptions = lazySchema10(
|
|
|
4700
4751
|
"1:4",
|
|
4701
4752
|
"4:1"
|
|
4702
4753
|
]).nullish(),
|
|
4703
|
-
imageSize:
|
|
4754
|
+
imageSize: z13.enum(["1K", "2K", "4K", "512"]).nullish()
|
|
4704
4755
|
}).nullish(),
|
|
4705
|
-
mediaResolution:
|
|
4706
|
-
responseModalities:
|
|
4707
|
-
serviceTier:
|
|
4756
|
+
mediaResolution: z13.enum(["low", "medium", "high", "ultra_high"]).nullish(),
|
|
4757
|
+
responseModalities: z13.array(z13.enum(["text", "image", "audio", "video", "document"])).nullish(),
|
|
4758
|
+
serviceTier: z13.enum(["flex", "standard", "priority"]).nullish(),
|
|
4708
4759
|
/**
|
|
4709
4760
|
* Alternative to AI SDK `system` message. If both are set, the AI SDK
|
|
4710
4761
|
* `system` message wins and a warning is emitted.
|
|
4711
4762
|
*/
|
|
4712
|
-
systemInstruction:
|
|
4763
|
+
systemInstruction: z13.string().nullish(),
|
|
4713
4764
|
/**
|
|
4714
4765
|
* Per-block signature for round-tripping `thought.signature` and
|
|
4715
4766
|
* `function_call.signature` blocks. Set by the SDK on output reasoning /
|
|
4716
4767
|
* tool-call parts; passed back unchanged on input parts so the API
|
|
4717
4768
|
* accepts the prior turn.
|
|
4718
4769
|
*/
|
|
4719
|
-
signature:
|
|
4770
|
+
signature: z13.string().nullish(),
|
|
4720
4771
|
/**
|
|
4721
4772
|
* Set by the SDK on output assistant messages. The converter uses it to
|
|
4722
4773
|
* decide which messages to drop when compacting under
|
|
4723
4774
|
* `previousInteractionId`.
|
|
4724
4775
|
*/
|
|
4725
|
-
interactionId:
|
|
4776
|
+
interactionId: z13.string().nullish(),
|
|
4726
4777
|
/**
|
|
4727
4778
|
* Maximum time, in milliseconds, to poll a background interaction (agent
|
|
4728
4779
|
* call) before giving up. Defaults to 30 minutes. Long-running agents
|
|
4729
4780
|
* such as deep research can take tens of minutes — increase if needed.
|
|
4730
4781
|
*/
|
|
4731
|
-
pollingTimeoutMs:
|
|
4782
|
+
pollingTimeoutMs: z13.number().int().positive().nullish(),
|
|
4732
4783
|
/**
|
|
4733
4784
|
* Run the interaction in the background. Required for agents whose
|
|
4734
4785
|
* server-side workflow cannot complete within a single request/response.
|
|
@@ -4737,7 +4788,7 @@ var googleInteractionsLanguageModelOptions = lazySchema10(
|
|
|
4737
4788
|
* reject `true`; see the agent's documentation for which mode it
|
|
4738
4789
|
* requires.
|
|
4739
4790
|
*/
|
|
4740
|
-
background:
|
|
4791
|
+
background: z13.boolean().nullish(),
|
|
4741
4792
|
/**
|
|
4742
4793
|
* Environment configuration for the agent sandbox. Only applies to agent
|
|
4743
4794
|
* calls (`google.interactions({ agent })`); ignored on model-id calls.
|
|
@@ -4747,36 +4798,36 @@ var googleInteractionsLanguageModelOptions = lazySchema10(
|
|
|
4747
4798
|
* - object: provision a fresh sandbox and optionally preload `sources`
|
|
4748
4799
|
* and/or constrain outbound traffic via `network`.
|
|
4749
4800
|
*/
|
|
4750
|
-
environment:
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
type:
|
|
4754
|
-
sources:
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
type:
|
|
4758
|
-
source:
|
|
4759
|
-
target:
|
|
4801
|
+
environment: z13.union([
|
|
4802
|
+
z13.string(),
|
|
4803
|
+
z13.object({
|
|
4804
|
+
type: z13.literal("remote"),
|
|
4805
|
+
sources: z13.array(
|
|
4806
|
+
z13.union([
|
|
4807
|
+
z13.object({
|
|
4808
|
+
type: z13.literal("gcs"),
|
|
4809
|
+
source: z13.string(),
|
|
4810
|
+
target: z13.string().nullish()
|
|
4760
4811
|
}),
|
|
4761
|
-
|
|
4762
|
-
type:
|
|
4763
|
-
source:
|
|
4764
|
-
target:
|
|
4812
|
+
z13.object({
|
|
4813
|
+
type: z13.literal("repository"),
|
|
4814
|
+
source: z13.string(),
|
|
4815
|
+
target: z13.string().nullish()
|
|
4765
4816
|
}),
|
|
4766
|
-
|
|
4767
|
-
type:
|
|
4768
|
-
content:
|
|
4769
|
-
target:
|
|
4817
|
+
z13.object({
|
|
4818
|
+
type: z13.literal("inline"),
|
|
4819
|
+
content: z13.string(),
|
|
4820
|
+
target: z13.string()
|
|
4770
4821
|
})
|
|
4771
4822
|
])
|
|
4772
4823
|
).nullish(),
|
|
4773
|
-
network:
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
allowlist:
|
|
4777
|
-
|
|
4778
|
-
domain:
|
|
4779
|
-
transform:
|
|
4824
|
+
network: z13.union([
|
|
4825
|
+
z13.literal("disabled"),
|
|
4826
|
+
z13.object({
|
|
4827
|
+
allowlist: z13.array(
|
|
4828
|
+
z13.object({
|
|
4829
|
+
domain: z13.string(),
|
|
4830
|
+
transform: z13.array(z13.record(z13.string(), z13.string())).nullish()
|
|
4780
4831
|
})
|
|
4781
4832
|
)
|
|
4782
4833
|
})
|