@ai-sdk/google 3.0.139 → 3.0.141
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 +20 -0
- package/dist/index.d.mts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +661 -552
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +657 -545
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +623 -514
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +626 -514
- package/dist/internal/index.mjs.map +1 -1
- package/docs/15-google-generative-ai.mdx +32 -12
- package/package.json +2 -2
- package/src/convert-to-google-generative-ai-messages.ts +71 -10
- package/src/google-error.ts +46 -6
- package/src/google-generative-ai-language-model.ts +43 -16
- package/src/google-generative-ai-prompt.ts +21 -2
- package/src/index.ts +4 -1
- package/src/interactions/prepare-google-interactions-tools.ts +7 -4
package/dist/internal/index.js
CHANGED
|
@@ -29,8 +29,9 @@ __export(index_exports, {
|
|
|
29
29
|
module.exports = __toCommonJS(index_exports);
|
|
30
30
|
|
|
31
31
|
// src/google-generative-ai-language-model.ts
|
|
32
|
+
var import_provider4 = require("@ai-sdk/provider");
|
|
32
33
|
var import_provider_utils5 = require("@ai-sdk/provider-utils");
|
|
33
|
-
var
|
|
34
|
+
var import_v44 = require("zod/v4");
|
|
34
35
|
|
|
35
36
|
// src/continue-google-stream.ts
|
|
36
37
|
function continueGoogleStream({
|
|
@@ -453,6 +454,19 @@ function isEmptyObjectSchema(jsonSchema) {
|
|
|
453
454
|
// src/convert-to-google-generative-ai-messages.ts
|
|
454
455
|
var import_provider2 = require("@ai-sdk/provider");
|
|
455
456
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
457
|
+
|
|
458
|
+
// src/google-generative-ai-prompt.ts
|
|
459
|
+
var import_v4 = require("zod/v4");
|
|
460
|
+
var googleVideoMetadataSchema = import_v4.z.object({
|
|
461
|
+
/** Start offset as a duration in seconds, e.g. `'3.5s'`. */
|
|
462
|
+
startOffset: import_v4.z.string().optional(),
|
|
463
|
+
/** End offset as a duration in seconds, e.g. `'10s'`. */
|
|
464
|
+
endOffset: import_v4.z.string().optional(),
|
|
465
|
+
/** Frames per second in the range (0, 24]. Defaults to 1. */
|
|
466
|
+
fps: import_v4.z.number().gt(0).max(24).optional()
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
// src/convert-to-google-generative-ai-messages.ts
|
|
456
470
|
var SKIP_THOUGHT_SIGNATURE_VALIDATOR = "skip_thought_signature_validator";
|
|
457
471
|
function getGoogleProviderOptions(providerOptions, providerOptionsName) {
|
|
458
472
|
const namespaces = [
|
|
@@ -502,6 +516,31 @@ function convertUrlToolResultPart(url, mediaType, supportedFunctionResponseUrls)
|
|
|
502
516
|
}
|
|
503
517
|
} : void 0;
|
|
504
518
|
}
|
|
519
|
+
function serializeFunctionResponseContent(value) {
|
|
520
|
+
return containsNonJsonValue(value) ? (0, import_provider_utils.secureJsonParse)((0, import_provider_utils.stringifyWithBigIntAndCycles)(value)) : value;
|
|
521
|
+
}
|
|
522
|
+
function containsNonJsonValue(value, ancestors = /* @__PURE__ */ new Set()) {
|
|
523
|
+
if (typeof value === "bigint") {
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
526
|
+
if (typeof value !== "object" || value === null) {
|
|
527
|
+
return false;
|
|
528
|
+
}
|
|
529
|
+
if (typeof value.toJSON === "function") {
|
|
530
|
+
return true;
|
|
531
|
+
}
|
|
532
|
+
if (ancestors.has(value)) {
|
|
533
|
+
return true;
|
|
534
|
+
}
|
|
535
|
+
ancestors.add(value);
|
|
536
|
+
try {
|
|
537
|
+
return Object.values(value).some(
|
|
538
|
+
(item) => containsNonJsonValue(item, ancestors)
|
|
539
|
+
);
|
|
540
|
+
} finally {
|
|
541
|
+
ancestors.delete(value);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
505
544
|
function appendToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true, supportedFunctionResponseUrls = {}) {
|
|
506
545
|
const functionResponseParts = [];
|
|
507
546
|
const responseTextParts = [];
|
|
@@ -531,12 +570,12 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId, include
|
|
|
531
570
|
if (functionResponsePart != null) {
|
|
532
571
|
functionResponseParts.push(functionResponsePart);
|
|
533
572
|
} else {
|
|
534
|
-
responseTextParts.push(
|
|
573
|
+
responseTextParts.push((0, import_provider_utils.stringifyWithBigIntAndCycles)(contentPart));
|
|
535
574
|
}
|
|
536
575
|
break;
|
|
537
576
|
}
|
|
538
577
|
default: {
|
|
539
|
-
responseTextParts.push(
|
|
578
|
+
responseTextParts.push((0, import_provider_utils.stringifyWithBigIntAndCycles)(contentPart));
|
|
540
579
|
break;
|
|
541
580
|
}
|
|
542
581
|
}
|
|
@@ -585,13 +624,13 @@ function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId, i
|
|
|
585
624
|
break;
|
|
586
625
|
}
|
|
587
626
|
default:
|
|
588
|
-
parts.push({ text:
|
|
627
|
+
parts.push({ text: (0, import_provider_utils.stringifyWithBigIntAndCycles)(contentPart) });
|
|
589
628
|
break;
|
|
590
629
|
}
|
|
591
630
|
}
|
|
592
631
|
}
|
|
593
632
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
594
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
633
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
595
634
|
const systemInstructionParts = [];
|
|
596
635
|
const contents = [];
|
|
597
636
|
let systemMessagesAllowed = true;
|
|
@@ -631,17 +670,24 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
631
670
|
}
|
|
632
671
|
case "file": {
|
|
633
672
|
const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
|
|
673
|
+
const rawVideoMetadata = (_g = getGoogleProviderOptions(
|
|
674
|
+
part.providerOptions,
|
|
675
|
+
providerOptionsName
|
|
676
|
+
)) == null ? void 0 : _g.videoMetadata;
|
|
677
|
+
const videoMetadata = rawVideoMetadata == null ? void 0 : googleVideoMetadataSchema.parse(rawVideoMetadata);
|
|
634
678
|
parts.push(
|
|
635
679
|
part.data instanceof URL ? {
|
|
636
680
|
fileData: {
|
|
637
681
|
mimeType: mediaType,
|
|
638
682
|
fileUri: part.data.protocol === "gs:" && part.originalUrl != null ? part.originalUrl : part.data.toString()
|
|
639
|
-
}
|
|
683
|
+
},
|
|
684
|
+
...videoMetadata != null ? { videoMetadata } : {}
|
|
640
685
|
} : {
|
|
641
686
|
inlineData: {
|
|
642
687
|
mimeType: mediaType,
|
|
643
688
|
data: (0, import_provider_utils.convertToBase64)(part.data)
|
|
644
|
-
}
|
|
689
|
+
},
|
|
690
|
+
...videoMetadata != null ? { videoMetadata } : {}
|
|
645
691
|
}
|
|
646
692
|
);
|
|
647
693
|
break;
|
|
@@ -720,7 +766,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
720
766
|
functionCall: {
|
|
721
767
|
...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
722
768
|
name: part.toolName,
|
|
723
|
-
args: part.input
|
|
769
|
+
args: parseToolCallInput(part.input)
|
|
724
770
|
},
|
|
725
771
|
thoughtSignature: effectiveThoughtSignature
|
|
726
772
|
};
|
|
@@ -802,7 +848,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
802
848
|
name: part.toolName,
|
|
803
849
|
response: {
|
|
804
850
|
name: part.toolName,
|
|
805
|
-
content: output.type === "execution-denied" ? (
|
|
851
|
+
content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool call execution denied." : serializeFunctionResponseContent(output.value)
|
|
806
852
|
}
|
|
807
853
|
}
|
|
808
854
|
});
|
|
@@ -832,6 +878,16 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
832
878
|
contents
|
|
833
879
|
};
|
|
834
880
|
}
|
|
881
|
+
function parseToolCallInput(input) {
|
|
882
|
+
if (typeof input !== "string") {
|
|
883
|
+
return input;
|
|
884
|
+
}
|
|
885
|
+
try {
|
|
886
|
+
return (0, import_provider_utils.secureJsonParse)(input);
|
|
887
|
+
} catch (e) {
|
|
888
|
+
return input;
|
|
889
|
+
}
|
|
890
|
+
}
|
|
835
891
|
|
|
836
892
|
// src/download-tool-result-files.ts
|
|
837
893
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
@@ -906,16 +962,17 @@ function getModelPath(modelId) {
|
|
|
906
962
|
|
|
907
963
|
// src/google-error.ts
|
|
908
964
|
var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
909
|
-
var
|
|
965
|
+
var import_v42 = require("zod/v4");
|
|
966
|
+
var getGoogleErrorSchema = () => import_v42.z.object({
|
|
967
|
+
code: import_v42.z.number().nullable(),
|
|
968
|
+
message: import_v42.z.string(),
|
|
969
|
+
status: import_v42.z.string(),
|
|
970
|
+
details: import_v42.z.array(import_v42.z.unknown()).nullish()
|
|
971
|
+
});
|
|
910
972
|
var googleErrorDataSchema = (0, import_provider_utils3.lazySchema)(
|
|
911
973
|
() => (0, import_provider_utils3.zodSchema)(
|
|
912
|
-
|
|
913
|
-
error:
|
|
914
|
-
code: import_v4.z.number().nullable(),
|
|
915
|
-
message: import_v4.z.string(),
|
|
916
|
-
status: import_v4.z.string(),
|
|
917
|
-
details: import_v4.z.array(import_v4.z.unknown()).nullish()
|
|
918
|
-
})
|
|
974
|
+
import_v42.z.object({
|
|
975
|
+
error: getGoogleErrorSchema()
|
|
919
976
|
})
|
|
920
977
|
)
|
|
921
978
|
);
|
|
@@ -923,26 +980,59 @@ var googleFailedResponseHandler = (0, import_provider_utils3.createJsonErrorResp
|
|
|
923
980
|
errorSchema: googleErrorDataSchema,
|
|
924
981
|
errorToMessage: (data) => data.error.message
|
|
925
982
|
});
|
|
983
|
+
function mapGoogleErrorStatusToHttpStatusCode(status) {
|
|
984
|
+
switch (status) {
|
|
985
|
+
case "CANCELLED":
|
|
986
|
+
return 499;
|
|
987
|
+
case "INVALID_ARGUMENT":
|
|
988
|
+
case "FAILED_PRECONDITION":
|
|
989
|
+
case "OUT_OF_RANGE":
|
|
990
|
+
return 400;
|
|
991
|
+
case "DEADLINE_EXCEEDED":
|
|
992
|
+
return 504;
|
|
993
|
+
case "NOT_FOUND":
|
|
994
|
+
return 404;
|
|
995
|
+
case "ALREADY_EXISTS":
|
|
996
|
+
case "ABORTED":
|
|
997
|
+
return 409;
|
|
998
|
+
case "PERMISSION_DENIED":
|
|
999
|
+
return 403;
|
|
1000
|
+
case "UNAUTHENTICATED":
|
|
1001
|
+
return 401;
|
|
1002
|
+
case "RESOURCE_EXHAUSTED":
|
|
1003
|
+
return 429;
|
|
1004
|
+
case "UNIMPLEMENTED":
|
|
1005
|
+
return 501;
|
|
1006
|
+
case "UNKNOWN":
|
|
1007
|
+
case "INTERNAL":
|
|
1008
|
+
case "DATA_LOSS":
|
|
1009
|
+
return 500;
|
|
1010
|
+
case "UNAVAILABLE":
|
|
1011
|
+
return 503;
|
|
1012
|
+
default:
|
|
1013
|
+
return void 0;
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
926
1016
|
|
|
927
1017
|
// src/google-generative-ai-options.ts
|
|
928
1018
|
var import_provider_utils4 = require("@ai-sdk/provider-utils");
|
|
929
|
-
var
|
|
1019
|
+
var import_v43 = require("zod/v4");
|
|
930
1020
|
var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
931
1021
|
() => (0, import_provider_utils4.zodSchema)(
|
|
932
|
-
|
|
933
|
-
responseModalities:
|
|
934
|
-
thinkingConfig:
|
|
935
|
-
thinkingBudget:
|
|
936
|
-
includeThoughts:
|
|
1022
|
+
import_v43.z.object({
|
|
1023
|
+
responseModalities: import_v43.z.array(import_v43.z.enum(["TEXT", "IMAGE"])).optional(),
|
|
1024
|
+
thinkingConfig: import_v43.z.object({
|
|
1025
|
+
thinkingBudget: import_v43.z.number().optional(),
|
|
1026
|
+
includeThoughts: import_v43.z.boolean().optional(),
|
|
937
1027
|
// https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level
|
|
938
|
-
thinkingLevel:
|
|
1028
|
+
thinkingLevel: import_v43.z.enum(["minimal", "low", "medium", "high"]).optional()
|
|
939
1029
|
}).optional(),
|
|
940
1030
|
/**
|
|
941
1031
|
* Optional.
|
|
942
1032
|
* The name of the cached content used as context to serve the prediction.
|
|
943
1033
|
* Format: cachedContents/{cachedContent}
|
|
944
1034
|
*/
|
|
945
|
-
cachedContent:
|
|
1035
|
+
cachedContent: import_v43.z.string().optional(),
|
|
946
1036
|
/**
|
|
947
1037
|
* Optional. Enable structured output. Default is true.
|
|
948
1038
|
*
|
|
@@ -951,13 +1041,13 @@ var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
951
1041
|
* Google Generative AI uses. You can use this to disable
|
|
952
1042
|
* structured outputs if you need to.
|
|
953
1043
|
*/
|
|
954
|
-
structuredOutputs:
|
|
1044
|
+
structuredOutputs: import_v43.z.boolean().optional(),
|
|
955
1045
|
/**
|
|
956
1046
|
* Optional. A list of unique safety settings for blocking unsafe content.
|
|
957
1047
|
*/
|
|
958
|
-
safetySettings:
|
|
959
|
-
|
|
960
|
-
category:
|
|
1048
|
+
safetySettings: import_v43.z.array(
|
|
1049
|
+
import_v43.z.object({
|
|
1050
|
+
category: import_v43.z.enum([
|
|
961
1051
|
"HARM_CATEGORY_UNSPECIFIED",
|
|
962
1052
|
"HARM_CATEGORY_HATE_SPEECH",
|
|
963
1053
|
"HARM_CATEGORY_DANGEROUS_CONTENT",
|
|
@@ -965,7 +1055,7 @@ var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
965
1055
|
"HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
|
966
1056
|
"HARM_CATEGORY_CIVIC_INTEGRITY"
|
|
967
1057
|
]),
|
|
968
|
-
threshold:
|
|
1058
|
+
threshold: import_v43.z.enum([
|
|
969
1059
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
|
970
1060
|
"BLOCK_LOW_AND_ABOVE",
|
|
971
1061
|
"BLOCK_MEDIUM_AND_ABOVE",
|
|
@@ -975,7 +1065,7 @@ var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
975
1065
|
])
|
|
976
1066
|
})
|
|
977
1067
|
).optional(),
|
|
978
|
-
threshold:
|
|
1068
|
+
threshold: import_v43.z.enum([
|
|
979
1069
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
|
980
1070
|
"BLOCK_LOW_AND_ABOVE",
|
|
981
1071
|
"BLOCK_MEDIUM_AND_ABOVE",
|
|
@@ -988,19 +1078,19 @@ var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
988
1078
|
*
|
|
989
1079
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
|
|
990
1080
|
*/
|
|
991
|
-
audioTimestamp:
|
|
1081
|
+
audioTimestamp: import_v43.z.boolean().optional(),
|
|
992
1082
|
/**
|
|
993
1083
|
* Optional. Defines labels used in billing reports. Available on Vertex AI only.
|
|
994
1084
|
*
|
|
995
1085
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
|
|
996
1086
|
*/
|
|
997
|
-
labels:
|
|
1087
|
+
labels: import_v43.z.record(import_v43.z.string(), import_v43.z.string()).optional(),
|
|
998
1088
|
/**
|
|
999
1089
|
* Optional. If specified, the media resolution specified will be used.
|
|
1000
1090
|
*
|
|
1001
1091
|
* https://ai.google.dev/api/generate-content#MediaResolution
|
|
1002
1092
|
*/
|
|
1003
|
-
mediaResolution:
|
|
1093
|
+
mediaResolution: import_v43.z.enum([
|
|
1004
1094
|
"MEDIA_RESOLUTION_UNSPECIFIED",
|
|
1005
1095
|
"MEDIA_RESOLUTION_LOW",
|
|
1006
1096
|
"MEDIA_RESOLUTION_MEDIUM",
|
|
@@ -1011,8 +1101,8 @@ var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
1011
1101
|
*
|
|
1012
1102
|
* https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios
|
|
1013
1103
|
*/
|
|
1014
|
-
imageConfig:
|
|
1015
|
-
aspectRatio:
|
|
1104
|
+
imageConfig: import_v43.z.object({
|
|
1105
|
+
aspectRatio: import_v43.z.enum([
|
|
1016
1106
|
"1:1",
|
|
1017
1107
|
"2:3",
|
|
1018
1108
|
"3:2",
|
|
@@ -1028,12 +1118,12 @@ var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
1028
1118
|
"1:4",
|
|
1029
1119
|
"4:1"
|
|
1030
1120
|
]).optional(),
|
|
1031
|
-
imageSize:
|
|
1121
|
+
imageSize: import_v43.z.enum(["1K", "2K", "4K", "512"]).optional(),
|
|
1032
1122
|
/**
|
|
1033
1123
|
* Optional. Controls the generation of people in images.
|
|
1034
1124
|
* Vertex AI only.
|
|
1035
1125
|
*/
|
|
1036
|
-
personGeneration:
|
|
1126
|
+
personGeneration: import_v43.z.enum([
|
|
1037
1127
|
"PERSON_GENERATION_UNSPECIFIED",
|
|
1038
1128
|
"ALLOW_ALL",
|
|
1039
1129
|
"ALLOW_ADULT",
|
|
@@ -1047,7 +1137,7 @@ var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
1047
1137
|
*
|
|
1048
1138
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
|
|
1049
1139
|
*/
|
|
1050
|
-
prominentPeople:
|
|
1140
|
+
prominentPeople: import_v43.z.enum([
|
|
1051
1141
|
"PROMINENT_PEOPLE_UNSPECIFIED",
|
|
1052
1142
|
"ALLOW_PROMINENT_PEOPLE",
|
|
1053
1143
|
"BLOCK_PROMINENT_PEOPLE"
|
|
@@ -1056,9 +1146,9 @@ var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
1056
1146
|
* Optional. The image output format for generated images.
|
|
1057
1147
|
* Vertex AI only.
|
|
1058
1148
|
*/
|
|
1059
|
-
imageOutputOptions:
|
|
1060
|
-
mimeType:
|
|
1061
|
-
compressionQuality:
|
|
1149
|
+
imageOutputOptions: import_v43.z.object({
|
|
1150
|
+
mimeType: import_v43.z.enum(["image/jpeg", "image/png"]).optional(),
|
|
1151
|
+
compressionQuality: import_v43.z.number().optional()
|
|
1062
1152
|
}).optional()
|
|
1063
1153
|
}).optional(),
|
|
1064
1154
|
/**
|
|
@@ -1067,10 +1157,10 @@ var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
1067
1157
|
*
|
|
1068
1158
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
1069
1159
|
*/
|
|
1070
|
-
retrievalConfig:
|
|
1071
|
-
latLng:
|
|
1072
|
-
latitude:
|
|
1073
|
-
longitude:
|
|
1160
|
+
retrievalConfig: import_v43.z.object({
|
|
1161
|
+
latLng: import_v43.z.object({
|
|
1162
|
+
latitude: import_v43.z.number(),
|
|
1163
|
+
longitude: import_v43.z.number()
|
|
1074
1164
|
}).optional()
|
|
1075
1165
|
}).optional(),
|
|
1076
1166
|
/**
|
|
@@ -1083,12 +1173,12 @@ var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
1083
1173
|
*
|
|
1084
1174
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc
|
|
1085
1175
|
*/
|
|
1086
|
-
streamFunctionCallArguments:
|
|
1176
|
+
streamFunctionCallArguments: import_v43.z.boolean().optional(),
|
|
1087
1177
|
/**
|
|
1088
1178
|
* Optional. The service tier to use for the request. Sent as the
|
|
1089
1179
|
* `serviceTier` body field. Gemini API only.
|
|
1090
1180
|
*/
|
|
1091
|
-
serviceTier:
|
|
1181
|
+
serviceTier: import_v43.z.enum(["standard", "flex", "priority"]).optional(),
|
|
1092
1182
|
/**
|
|
1093
1183
|
* Optional. Resumes a response that stopped with `MAX_TOKENS` because it
|
|
1094
1184
|
* used up its `maxOutputTokens` budget (Gemini 4 long decode). Pass the
|
|
@@ -1098,7 +1188,7 @@ var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
1098
1188
|
* per-request cap while budget remains (`CONTINUATION`) are continued
|
|
1099
1189
|
* automatically. Sent as the `continuationToken` body field.
|
|
1100
1190
|
*/
|
|
1101
|
-
continuationToken:
|
|
1191
|
+
continuationToken: import_v43.z.string().optional(),
|
|
1102
1192
|
/**
|
|
1103
1193
|
* Optional. Vertex AI only. Sent as the
|
|
1104
1194
|
* `X-Vertex-AI-LLM-Shared-Request-Type` request header to select a
|
|
@@ -1109,7 +1199,7 @@ var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
1109
1199
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/priority-paygo
|
|
1110
1200
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/flex-paygo
|
|
1111
1201
|
*/
|
|
1112
|
-
sharedRequestType:
|
|
1202
|
+
sharedRequestType: import_v43.z.enum(["priority", "flex", "standard"]).optional(),
|
|
1113
1203
|
/**
|
|
1114
1204
|
* Optional. Vertex AI only. Sent as the `X-Vertex-AI-LLM-Request-Type`
|
|
1115
1205
|
* request header. Set to `'shared'` together with `sharedRequestType`
|
|
@@ -1117,7 +1207,7 @@ var googleLanguageModelOptions = (0, import_provider_utils4.lazySchema)(
|
|
|
1117
1207
|
*
|
|
1118
1208
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/priority-paygo
|
|
1119
1209
|
*/
|
|
1120
|
-
requestType:
|
|
1210
|
+
requestType: import_v43.z.enum(["shared"]).optional()
|
|
1121
1211
|
})
|
|
1122
1212
|
)
|
|
1123
1213
|
);
|
|
@@ -2146,10 +2236,11 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2146
2236
|
options.headers,
|
|
2147
2237
|
extraHeaders
|
|
2148
2238
|
);
|
|
2239
|
+
const url = `${this.config.baseURL}/${getModelPath(
|
|
2240
|
+
this.modelId
|
|
2241
|
+
)}:streamGenerateContent?alt=sse`;
|
|
2149
2242
|
const streamGenerateContent = (body) => (0, import_provider_utils5.postJsonToApi)({
|
|
2150
|
-
url
|
|
2151
|
-
this.modelId
|
|
2152
|
-
)}:streamGenerateContent?alt=sse`,
|
|
2243
|
+
url,
|
|
2153
2244
|
headers,
|
|
2154
2245
|
body,
|
|
2155
2246
|
failedResponseHandler: googleFailedResponseHandler,
|
|
@@ -2239,7 +2330,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2239
2330
|
controller.enqueue({ type: "stream-start", warnings });
|
|
2240
2331
|
},
|
|
2241
2332
|
transform(chunk, controller) {
|
|
2242
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
2333
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2243
2334
|
if (options.includeRawChunks) {
|
|
2244
2335
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
2245
2336
|
}
|
|
@@ -2248,6 +2339,23 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2248
2339
|
return;
|
|
2249
2340
|
}
|
|
2250
2341
|
const value = chunk.value;
|
|
2342
|
+
if (value.error != null) {
|
|
2343
|
+
finishReason = { unified: "error", raw: void 0 };
|
|
2344
|
+
const error = value.error;
|
|
2345
|
+
controller.enqueue({
|
|
2346
|
+
type: "error",
|
|
2347
|
+
error: new import_provider4.APICallError({
|
|
2348
|
+
message: error.message,
|
|
2349
|
+
url,
|
|
2350
|
+
requestBodyValues: args,
|
|
2351
|
+
statusCode: (_a = error.code) != null ? _a : mapGoogleErrorStatusToHttpStatusCode(error.status),
|
|
2352
|
+
responseHeaders,
|
|
2353
|
+
responseBody: JSON.stringify({ error }),
|
|
2354
|
+
data: error
|
|
2355
|
+
})
|
|
2356
|
+
});
|
|
2357
|
+
return;
|
|
2358
|
+
}
|
|
2251
2359
|
if (!hasEmittedResponseMetadata && value.responseId != null) {
|
|
2252
2360
|
hasEmittedResponseMetadata = true;
|
|
2253
2361
|
controller.enqueue({
|
|
@@ -2269,7 +2377,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2269
2377
|
};
|
|
2270
2378
|
}
|
|
2271
2379
|
}
|
|
2272
|
-
const candidate = (
|
|
2380
|
+
const candidate = (_b = value.candidates) == null ? void 0 : _b[0];
|
|
2273
2381
|
if (candidate != null) {
|
|
2274
2382
|
if (candidate.groundingMetadata != null) {
|
|
2275
2383
|
lastGroundingMetadata = candidate.groundingMetadata;
|
|
@@ -2304,9 +2412,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2304
2412
|
}
|
|
2305
2413
|
}
|
|
2306
2414
|
if (content != null) {
|
|
2307
|
-
const parts = (
|
|
2415
|
+
const parts = (_c = content.parts) != null ? _c : [];
|
|
2308
2416
|
for (const part of parts) {
|
|
2309
|
-
if ("executableCode" in part && ((
|
|
2417
|
+
if ("executableCode" in part && ((_d = part.executableCode) == null ? void 0 : _d.code)) {
|
|
2310
2418
|
const toolCallId = generateId2();
|
|
2311
2419
|
lastCodeExecutionToolCallId = toolCallId;
|
|
2312
2420
|
controller.enqueue({
|
|
@@ -2325,7 +2433,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2325
2433
|
toolName: "code_execution",
|
|
2326
2434
|
result: {
|
|
2327
2435
|
outcome: part.codeExecutionResult.outcome,
|
|
2328
|
-
output: (
|
|
2436
|
+
output: (_e = part.codeExecutionResult.output) != null ? _e : ""
|
|
2329
2437
|
}
|
|
2330
2438
|
});
|
|
2331
2439
|
}
|
|
@@ -2419,7 +2527,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2419
2527
|
providerMetadata: fileMeta
|
|
2420
2528
|
});
|
|
2421
2529
|
} else if ("toolCall" in part && part.toolCall) {
|
|
2422
|
-
const toolCallId = (
|
|
2530
|
+
const toolCallId = (_f = part.toolCall.id) != null ? _f : generateId2();
|
|
2423
2531
|
lastServerToolCallId = toolCallId;
|
|
2424
2532
|
const serverMeta = {
|
|
2425
2533
|
[providerOptionsName]: {
|
|
@@ -2432,13 +2540,13 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2432
2540
|
type: "tool-call",
|
|
2433
2541
|
toolCallId,
|
|
2434
2542
|
toolName: `server:${part.toolCall.toolType}`,
|
|
2435
|
-
input: JSON.stringify((
|
|
2543
|
+
input: JSON.stringify((_g = part.toolCall.args) != null ? _g : {}),
|
|
2436
2544
|
providerExecuted: true,
|
|
2437
2545
|
dynamic: true,
|
|
2438
2546
|
providerMetadata: serverMeta
|
|
2439
2547
|
});
|
|
2440
2548
|
} else if ("toolResponse" in part && part.toolResponse) {
|
|
2441
|
-
const responseToolCallId = (
|
|
2549
|
+
const responseToolCallId = (_h = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _h : generateId2();
|
|
2442
2550
|
const serverMeta = {
|
|
2443
2551
|
[providerOptionsName]: {
|
|
2444
2552
|
...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
|
|
@@ -2450,7 +2558,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2450
2558
|
type: "tool-result",
|
|
2451
2559
|
toolCallId: responseToolCallId,
|
|
2452
2560
|
toolName: `server:${part.toolResponse.toolType}`,
|
|
2453
|
-
result: (
|
|
2561
|
+
result: (_i = part.toolResponse.response) != null ? _i : {},
|
|
2454
2562
|
providerMetadata: serverMeta
|
|
2455
2563
|
});
|
|
2456
2564
|
lastServerToolCallId = void 0;
|
|
@@ -2469,7 +2577,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2469
2577
|
const isNoArgsCompleteCall = part.functionCall.name != null && part.functionCall.args == null && part.functionCall.partialArgs == null && part.functionCall.willContinue !== true;
|
|
2470
2578
|
if (isStreamingChunk) {
|
|
2471
2579
|
if (part.functionCall.name != null) {
|
|
2472
|
-
const toolCallId = (
|
|
2580
|
+
const toolCallId = (_j = part.functionCall.id) != null ? _j : generateId2();
|
|
2473
2581
|
const accumulator = new GoogleJSONAccumulator();
|
|
2474
2582
|
activeStreamingToolCalls.push({
|
|
2475
2583
|
toolCallId,
|
|
@@ -2517,9 +2625,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2517
2625
|
} else if (isTerminalChunk && activeStreamingToolCalls.length > 0) {
|
|
2518
2626
|
finishActiveStreamingToolCall(controller);
|
|
2519
2627
|
} else if (isCompleteCall) {
|
|
2520
|
-
const toolCallId = (
|
|
2628
|
+
const toolCallId = (_k = part.functionCall.id) != null ? _k : generateId2();
|
|
2521
2629
|
const toolName = part.functionCall.name;
|
|
2522
|
-
const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((
|
|
2630
|
+
const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_l = part.functionCall.args) != null ? _l : {});
|
|
2523
2631
|
controller.enqueue({
|
|
2524
2632
|
type: "tool-input-start",
|
|
2525
2633
|
id: toolCallId,
|
|
@@ -2546,7 +2654,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2546
2654
|
});
|
|
2547
2655
|
hasToolCalls = true;
|
|
2548
2656
|
} else if (isNoArgsCompleteCall) {
|
|
2549
|
-
const toolCallId = (
|
|
2657
|
+
const toolCallId = (_m = part.functionCall.id) != null ? _m : generateId2();
|
|
2550
2658
|
const toolName = part.functionCall.name;
|
|
2551
2659
|
controller.enqueue({
|
|
2552
2660
|
type: "tool-input-start",
|
|
@@ -2734,205 +2842,206 @@ function extractSources({
|
|
|
2734
2842
|
}
|
|
2735
2843
|
return sources.length > 0 ? sources : void 0;
|
|
2736
2844
|
}
|
|
2737
|
-
var getGroundingMetadataSchema = () =>
|
|
2738
|
-
webSearchQueries:
|
|
2739
|
-
imageSearchQueries:
|
|
2740
|
-
retrievalQueries:
|
|
2741
|
-
searchEntryPoint:
|
|
2742
|
-
groundingChunks:
|
|
2743
|
-
|
|
2744
|
-
web:
|
|
2745
|
-
image:
|
|
2746
|
-
sourceUri:
|
|
2747
|
-
imageUri:
|
|
2748
|
-
title:
|
|
2749
|
-
domain:
|
|
2845
|
+
var getGroundingMetadataSchema = () => import_v44.z.object({
|
|
2846
|
+
webSearchQueries: import_v44.z.array(import_v44.z.string()).nullish(),
|
|
2847
|
+
imageSearchQueries: import_v44.z.array(import_v44.z.string()).nullish(),
|
|
2848
|
+
retrievalQueries: import_v44.z.array(import_v44.z.string()).nullish(),
|
|
2849
|
+
searchEntryPoint: import_v44.z.object({ renderedContent: import_v44.z.string() }).nullish(),
|
|
2850
|
+
groundingChunks: import_v44.z.array(
|
|
2851
|
+
import_v44.z.object({
|
|
2852
|
+
web: import_v44.z.object({ uri: import_v44.z.string(), title: import_v44.z.string().nullish() }).nullish(),
|
|
2853
|
+
image: import_v44.z.object({
|
|
2854
|
+
sourceUri: import_v44.z.string(),
|
|
2855
|
+
imageUri: import_v44.z.string(),
|
|
2856
|
+
title: import_v44.z.string().nullish(),
|
|
2857
|
+
domain: import_v44.z.string().nullish()
|
|
2750
2858
|
}).nullish(),
|
|
2751
|
-
retrievedContext:
|
|
2752
|
-
uri:
|
|
2753
|
-
title:
|
|
2754
|
-
text:
|
|
2755
|
-
fileSearchStore:
|
|
2756
|
-
customMetadata:
|
|
2757
|
-
|
|
2758
|
-
key:
|
|
2759
|
-
stringValue:
|
|
2760
|
-
numericValue:
|
|
2761
|
-
stringListValue:
|
|
2859
|
+
retrievedContext: import_v44.z.object({
|
|
2860
|
+
uri: import_v44.z.string().nullish(),
|
|
2861
|
+
title: import_v44.z.string().nullish(),
|
|
2862
|
+
text: import_v44.z.string().nullish(),
|
|
2863
|
+
fileSearchStore: import_v44.z.string().nullish(),
|
|
2864
|
+
customMetadata: import_v44.z.array(
|
|
2865
|
+
import_v44.z.object({
|
|
2866
|
+
key: import_v44.z.string(),
|
|
2867
|
+
stringValue: import_v44.z.string().nullish(),
|
|
2868
|
+
numericValue: import_v44.z.number().nullish(),
|
|
2869
|
+
stringListValue: import_v44.z.object({ values: import_v44.z.array(import_v44.z.string()).nullish() }).nullish()
|
|
2762
2870
|
})
|
|
2763
2871
|
).nullish()
|
|
2764
2872
|
}).nullish(),
|
|
2765
|
-
maps:
|
|
2766
|
-
uri:
|
|
2767
|
-
title:
|
|
2768
|
-
text:
|
|
2769
|
-
placeId:
|
|
2873
|
+
maps: import_v44.z.object({
|
|
2874
|
+
uri: import_v44.z.string().nullish(),
|
|
2875
|
+
title: import_v44.z.string().nullish(),
|
|
2876
|
+
text: import_v44.z.string().nullish(),
|
|
2877
|
+
placeId: import_v44.z.string().nullish()
|
|
2770
2878
|
}).nullish()
|
|
2771
2879
|
})
|
|
2772
2880
|
).nullish(),
|
|
2773
|
-
groundingSupports:
|
|
2774
|
-
|
|
2775
|
-
segment:
|
|
2776
|
-
startIndex:
|
|
2777
|
-
endIndex:
|
|
2778
|
-
text:
|
|
2881
|
+
groundingSupports: import_v44.z.array(
|
|
2882
|
+
import_v44.z.object({
|
|
2883
|
+
segment: import_v44.z.object({
|
|
2884
|
+
startIndex: import_v44.z.number().nullish(),
|
|
2885
|
+
endIndex: import_v44.z.number().nullish(),
|
|
2886
|
+
text: import_v44.z.string().nullish()
|
|
2779
2887
|
}).nullish(),
|
|
2780
|
-
segment_text:
|
|
2781
|
-
groundingChunkIndices:
|
|
2782
|
-
supportChunkIndices:
|
|
2783
|
-
confidenceScores:
|
|
2784
|
-
confidenceScore:
|
|
2888
|
+
segment_text: import_v44.z.string().nullish(),
|
|
2889
|
+
groundingChunkIndices: import_v44.z.array(import_v44.z.number()).nullish(),
|
|
2890
|
+
supportChunkIndices: import_v44.z.array(import_v44.z.number()).nullish(),
|
|
2891
|
+
confidenceScores: import_v44.z.array(import_v44.z.number()).nullish(),
|
|
2892
|
+
confidenceScore: import_v44.z.array(import_v44.z.number()).nullish()
|
|
2785
2893
|
})
|
|
2786
2894
|
).nullish(),
|
|
2787
|
-
retrievalMetadata:
|
|
2788
|
-
|
|
2789
|
-
webDynamicRetrievalScore:
|
|
2895
|
+
retrievalMetadata: import_v44.z.union([
|
|
2896
|
+
import_v44.z.object({
|
|
2897
|
+
webDynamicRetrievalScore: import_v44.z.number()
|
|
2790
2898
|
}),
|
|
2791
|
-
|
|
2899
|
+
import_v44.z.object({})
|
|
2792
2900
|
]).nullish()
|
|
2793
2901
|
});
|
|
2794
|
-
var partialArgSchema = () =>
|
|
2795
|
-
jsonPath:
|
|
2796
|
-
stringValue:
|
|
2797
|
-
numberValue:
|
|
2798
|
-
boolValue:
|
|
2799
|
-
nullValue:
|
|
2800
|
-
willContinue:
|
|
2902
|
+
var partialArgSchema = () => import_v44.z.object({
|
|
2903
|
+
jsonPath: import_v44.z.string(),
|
|
2904
|
+
stringValue: import_v44.z.string().nullish(),
|
|
2905
|
+
numberValue: import_v44.z.number().nullish(),
|
|
2906
|
+
boolValue: import_v44.z.boolean().nullish(),
|
|
2907
|
+
nullValue: import_v44.z.unknown().nullish(),
|
|
2908
|
+
willContinue: import_v44.z.boolean().nullish()
|
|
2801
2909
|
});
|
|
2802
|
-
var getContentSchema = () =>
|
|
2803
|
-
parts:
|
|
2804
|
-
|
|
2910
|
+
var getContentSchema = () => import_v44.z.object({
|
|
2911
|
+
parts: import_v44.z.array(
|
|
2912
|
+
import_v44.z.union([
|
|
2805
2913
|
// note: order matters since text can be fully empty
|
|
2806
|
-
|
|
2807
|
-
functionCall:
|
|
2808
|
-
id:
|
|
2809
|
-
name:
|
|
2810
|
-
args:
|
|
2811
|
-
partialArgs:
|
|
2812
|
-
willContinue:
|
|
2914
|
+
import_v44.z.object({
|
|
2915
|
+
functionCall: import_v44.z.object({
|
|
2916
|
+
id: import_v44.z.string().nullish(),
|
|
2917
|
+
name: import_v44.z.string().nullish(),
|
|
2918
|
+
args: import_v44.z.unknown().nullish(),
|
|
2919
|
+
partialArgs: import_v44.z.array(partialArgSchema()).nullish(),
|
|
2920
|
+
willContinue: import_v44.z.boolean().nullish()
|
|
2813
2921
|
}),
|
|
2814
|
-
thoughtSignature:
|
|
2922
|
+
thoughtSignature: import_v44.z.string().nullish()
|
|
2815
2923
|
}),
|
|
2816
|
-
|
|
2817
|
-
inlineData:
|
|
2818
|
-
mimeType:
|
|
2819
|
-
data:
|
|
2924
|
+
import_v44.z.object({
|
|
2925
|
+
inlineData: import_v44.z.object({
|
|
2926
|
+
mimeType: import_v44.z.string(),
|
|
2927
|
+
data: import_v44.z.string()
|
|
2820
2928
|
}),
|
|
2821
|
-
thought:
|
|
2822
|
-
thoughtSignature:
|
|
2929
|
+
thought: import_v44.z.boolean().nullish(),
|
|
2930
|
+
thoughtSignature: import_v44.z.string().nullish()
|
|
2823
2931
|
}),
|
|
2824
|
-
|
|
2825
|
-
toolCall:
|
|
2826
|
-
toolType:
|
|
2827
|
-
args:
|
|
2828
|
-
id:
|
|
2932
|
+
import_v44.z.object({
|
|
2933
|
+
toolCall: import_v44.z.object({
|
|
2934
|
+
toolType: import_v44.z.string(),
|
|
2935
|
+
args: import_v44.z.unknown().nullish(),
|
|
2936
|
+
id: import_v44.z.string()
|
|
2829
2937
|
}),
|
|
2830
|
-
thoughtSignature:
|
|
2938
|
+
thoughtSignature: import_v44.z.string().nullish()
|
|
2831
2939
|
}),
|
|
2832
|
-
|
|
2833
|
-
toolResponse:
|
|
2834
|
-
toolType:
|
|
2835
|
-
response:
|
|
2836
|
-
id:
|
|
2940
|
+
import_v44.z.object({
|
|
2941
|
+
toolResponse: import_v44.z.object({
|
|
2942
|
+
toolType: import_v44.z.string(),
|
|
2943
|
+
response: import_v44.z.unknown().nullish(),
|
|
2944
|
+
id: import_v44.z.string()
|
|
2837
2945
|
}),
|
|
2838
|
-
thoughtSignature:
|
|
2946
|
+
thoughtSignature: import_v44.z.string().nullish()
|
|
2839
2947
|
}),
|
|
2840
|
-
|
|
2841
|
-
executableCode:
|
|
2842
|
-
language:
|
|
2843
|
-
code:
|
|
2948
|
+
import_v44.z.object({
|
|
2949
|
+
executableCode: import_v44.z.object({
|
|
2950
|
+
language: import_v44.z.string(),
|
|
2951
|
+
code: import_v44.z.string()
|
|
2844
2952
|
}).nullish(),
|
|
2845
|
-
codeExecutionResult:
|
|
2846
|
-
outcome:
|
|
2847
|
-
output:
|
|
2953
|
+
codeExecutionResult: import_v44.z.object({
|
|
2954
|
+
outcome: import_v44.z.string(),
|
|
2955
|
+
output: import_v44.z.string().nullish()
|
|
2848
2956
|
}).nullish(),
|
|
2849
|
-
text:
|
|
2850
|
-
thought:
|
|
2851
|
-
thoughtSignature:
|
|
2957
|
+
text: import_v44.z.string().nullish(),
|
|
2958
|
+
thought: import_v44.z.boolean().nullish(),
|
|
2959
|
+
thoughtSignature: import_v44.z.string().nullish()
|
|
2852
2960
|
})
|
|
2853
2961
|
])
|
|
2854
2962
|
).nullish()
|
|
2855
2963
|
});
|
|
2856
|
-
var getSafetyRatingSchema = () =>
|
|
2857
|
-
category:
|
|
2858
|
-
probability:
|
|
2859
|
-
probabilityScore:
|
|
2860
|
-
severity:
|
|
2861
|
-
severityScore:
|
|
2862
|
-
blocked:
|
|
2964
|
+
var getSafetyRatingSchema = () => import_v44.z.object({
|
|
2965
|
+
category: import_v44.z.string().nullish(),
|
|
2966
|
+
probability: import_v44.z.string().nullish(),
|
|
2967
|
+
probabilityScore: import_v44.z.number().nullish(),
|
|
2968
|
+
severity: import_v44.z.string().nullish(),
|
|
2969
|
+
severityScore: import_v44.z.number().nullish(),
|
|
2970
|
+
blocked: import_v44.z.boolean().nullish()
|
|
2863
2971
|
});
|
|
2864
|
-
var tokenDetailsSchema = () =>
|
|
2865
|
-
|
|
2866
|
-
modality:
|
|
2867
|
-
tokenCount:
|
|
2868
|
-
}).catchall(
|
|
2972
|
+
var tokenDetailsSchema = () => import_v44.z.array(
|
|
2973
|
+
import_v44.z.object({
|
|
2974
|
+
modality: import_v44.z.string(),
|
|
2975
|
+
tokenCount: import_v44.z.number()
|
|
2976
|
+
}).catchall(import_v44.z.json())
|
|
2869
2977
|
).nullish();
|
|
2870
|
-
var usageSchema = () =>
|
|
2871
|
-
cachedContentTokenCount:
|
|
2872
|
-
thoughtsTokenCount:
|
|
2873
|
-
promptTokenCount:
|
|
2874
|
-
candidatesTokenCount:
|
|
2875
|
-
toolUsePromptTokenCount:
|
|
2876
|
-
totalTokenCount:
|
|
2978
|
+
var usageSchema = () => import_v44.z.object({
|
|
2979
|
+
cachedContentTokenCount: import_v44.z.number().nullish(),
|
|
2980
|
+
thoughtsTokenCount: import_v44.z.number().nullish(),
|
|
2981
|
+
promptTokenCount: import_v44.z.number().nullish(),
|
|
2982
|
+
candidatesTokenCount: import_v44.z.number().nullish(),
|
|
2983
|
+
toolUsePromptTokenCount: import_v44.z.number().nullish(),
|
|
2984
|
+
totalTokenCount: import_v44.z.number().nullish(),
|
|
2877
2985
|
// https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType
|
|
2878
|
-
trafficType:
|
|
2879
|
-
serviceTier:
|
|
2986
|
+
trafficType: import_v44.z.string().nullish(),
|
|
2987
|
+
serviceTier: import_v44.z.string().nullish(),
|
|
2880
2988
|
// https://ai.google.dev/api/generate-content#Modality
|
|
2881
2989
|
promptTokensDetails: tokenDetailsSchema(),
|
|
2882
2990
|
cacheTokensDetails: tokenDetailsSchema(),
|
|
2883
2991
|
candidatesTokensDetails: tokenDetailsSchema(),
|
|
2884
2992
|
toolUsePromptTokensDetails: tokenDetailsSchema()
|
|
2885
|
-
}).catchall(
|
|
2886
|
-
var getUrlContextMetadataSchema = () =>
|
|
2887
|
-
urlMetadata:
|
|
2888
|
-
|
|
2889
|
-
retrievedUrl:
|
|
2890
|
-
urlRetrievalStatus:
|
|
2993
|
+
}).catchall(import_v44.z.json());
|
|
2994
|
+
var getUrlContextMetadataSchema = () => import_v44.z.object({
|
|
2995
|
+
urlMetadata: import_v44.z.array(
|
|
2996
|
+
import_v44.z.object({
|
|
2997
|
+
retrievedUrl: import_v44.z.string(),
|
|
2998
|
+
urlRetrievalStatus: import_v44.z.string()
|
|
2891
2999
|
})
|
|
2892
3000
|
).nullish()
|
|
2893
3001
|
});
|
|
2894
3002
|
var responseSchema = (0, import_provider_utils5.lazySchema)(
|
|
2895
3003
|
() => (0, import_provider_utils5.zodSchema)(
|
|
2896
|
-
|
|
2897
|
-
responseId:
|
|
2898
|
-
candidates:
|
|
2899
|
-
|
|
2900
|
-
content: getContentSchema().nullish().or(
|
|
2901
|
-
finishReason:
|
|
2902
|
-
finishMessage:
|
|
2903
|
-
continuationToken:
|
|
2904
|
-
safetyRatings:
|
|
3004
|
+
import_v44.z.object({
|
|
3005
|
+
responseId: import_v44.z.string().nullish(),
|
|
3006
|
+
candidates: import_v44.z.array(
|
|
3007
|
+
import_v44.z.object({
|
|
3008
|
+
content: getContentSchema().nullish().or(import_v44.z.object({}).strict()),
|
|
3009
|
+
finishReason: import_v44.z.string().nullish(),
|
|
3010
|
+
finishMessage: import_v44.z.string().nullish(),
|
|
3011
|
+
continuationToken: import_v44.z.string().nullish(),
|
|
3012
|
+
safetyRatings: import_v44.z.array(getSafetyRatingSchema()).nullish(),
|
|
2905
3013
|
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
|
2906
3014
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2907
3015
|
})
|
|
2908
3016
|
).nullish(),
|
|
2909
3017
|
usageMetadata: usageSchema().nullish(),
|
|
2910
|
-
promptFeedback:
|
|
2911
|
-
blockReason:
|
|
2912
|
-
safetyRatings:
|
|
3018
|
+
promptFeedback: import_v44.z.object({
|
|
3019
|
+
blockReason: import_v44.z.string().nullish(),
|
|
3020
|
+
safetyRatings: import_v44.z.array(getSafetyRatingSchema()).nullish()
|
|
2913
3021
|
}).nullish()
|
|
2914
3022
|
})
|
|
2915
3023
|
)
|
|
2916
3024
|
);
|
|
2917
3025
|
var chunkSchema = (0, import_provider_utils5.lazySchema)(
|
|
2918
3026
|
() => (0, import_provider_utils5.zodSchema)(
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
3027
|
+
import_v44.z.object({
|
|
3028
|
+
error: getGoogleErrorSchema().nullish(),
|
|
3029
|
+
responseId: import_v44.z.string().nullish(),
|
|
3030
|
+
candidates: import_v44.z.array(
|
|
3031
|
+
import_v44.z.object({
|
|
2923
3032
|
content: getContentSchema().nullish(),
|
|
2924
|
-
finishReason:
|
|
2925
|
-
finishMessage:
|
|
2926
|
-
continuationToken:
|
|
2927
|
-
safetyRatings:
|
|
3033
|
+
finishReason: import_v44.z.string().nullish(),
|
|
3034
|
+
finishMessage: import_v44.z.string().nullish(),
|
|
3035
|
+
continuationToken: import_v44.z.string().nullish(),
|
|
3036
|
+
safetyRatings: import_v44.z.array(getSafetyRatingSchema()).nullish(),
|
|
2928
3037
|
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
|
2929
3038
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
2930
3039
|
})
|
|
2931
3040
|
).nullish(),
|
|
2932
3041
|
usageMetadata: usageSchema().nullish(),
|
|
2933
|
-
promptFeedback:
|
|
2934
|
-
blockReason:
|
|
2935
|
-
safetyRatings:
|
|
3042
|
+
promptFeedback: import_v44.z.object({
|
|
3043
|
+
blockReason: import_v44.z.string().nullish(),
|
|
3044
|
+
safetyRatings: import_v44.z.array(getSafetyRatingSchema()).nullish()
|
|
2936
3045
|
}).nullish()
|
|
2937
3046
|
})
|
|
2938
3047
|
)
|
|
@@ -2943,43 +3052,43 @@ function isConfirmedPromptBlockReason(blockReason) {
|
|
|
2943
3052
|
|
|
2944
3053
|
// src/tool/code-execution.ts
|
|
2945
3054
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
2946
|
-
var
|
|
3055
|
+
var import_v45 = require("zod/v4");
|
|
2947
3056
|
var codeExecution = (0, import_provider_utils6.createProviderToolFactoryWithOutputSchema)({
|
|
2948
3057
|
id: "google.code_execution",
|
|
2949
|
-
inputSchema:
|
|
2950
|
-
language:
|
|
2951
|
-
code:
|
|
3058
|
+
inputSchema: import_v45.z.object({
|
|
3059
|
+
language: import_v45.z.string().describe("The programming language of the code."),
|
|
3060
|
+
code: import_v45.z.string().describe("The code to be executed.")
|
|
2952
3061
|
}),
|
|
2953
|
-
outputSchema:
|
|
2954
|
-
outcome:
|
|
2955
|
-
output:
|
|
3062
|
+
outputSchema: import_v45.z.object({
|
|
3063
|
+
outcome: import_v45.z.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
|
|
3064
|
+
output: import_v45.z.string().describe("The output from the code execution.")
|
|
2956
3065
|
})
|
|
2957
3066
|
});
|
|
2958
3067
|
|
|
2959
3068
|
// src/tool/enterprise-web-search.ts
|
|
2960
3069
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
2961
|
-
var
|
|
3070
|
+
var import_v46 = require("zod/v4");
|
|
2962
3071
|
var enterpriseWebSearch = (0, import_provider_utils7.createProviderToolFactory)({
|
|
2963
3072
|
id: "google.enterprise_web_search",
|
|
2964
|
-
inputSchema: (0, import_provider_utils7.lazySchema)(() => (0, import_provider_utils7.zodSchema)(
|
|
3073
|
+
inputSchema: (0, import_provider_utils7.lazySchema)(() => (0, import_provider_utils7.zodSchema)(import_v46.z.object({})))
|
|
2965
3074
|
});
|
|
2966
3075
|
|
|
2967
3076
|
// src/tool/file-search.ts
|
|
2968
3077
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
2969
|
-
var
|
|
2970
|
-
var fileSearchArgsBaseSchema = () =>
|
|
3078
|
+
var import_v47 = require("zod/v4");
|
|
3079
|
+
var fileSearchArgsBaseSchema = () => import_v47.z.object({
|
|
2971
3080
|
/** The names of the file_search_stores to retrieve from.
|
|
2972
3081
|
* Example: `fileSearchStores/my-file-search-store-123`
|
|
2973
3082
|
*/
|
|
2974
|
-
fileSearchStoreNames:
|
|
3083
|
+
fileSearchStoreNames: import_v47.z.array(import_v47.z.string()).describe(
|
|
2975
3084
|
"The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
|
|
2976
3085
|
),
|
|
2977
3086
|
/** The number of file search retrieval chunks to retrieve. */
|
|
2978
|
-
topK:
|
|
3087
|
+
topK: import_v47.z.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
|
|
2979
3088
|
/** Metadata filter to apply to the file search retrieval documents.
|
|
2980
3089
|
* See https://google.aip.dev/160 for the syntax of the filter expression.
|
|
2981
3090
|
*/
|
|
2982
|
-
metadataFilter:
|
|
3091
|
+
metadataFilter: import_v47.z.string().describe(
|
|
2983
3092
|
"Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
|
|
2984
3093
|
).optional()
|
|
2985
3094
|
}).passthrough();
|
|
@@ -2993,23 +3102,23 @@ var fileSearch = (0, import_provider_utils8.createProviderToolFactory)({
|
|
|
2993
3102
|
|
|
2994
3103
|
// src/tool/google-maps.ts
|
|
2995
3104
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
2996
|
-
var
|
|
3105
|
+
var import_v48 = require("zod/v4");
|
|
2997
3106
|
var googleMaps = (0, import_provider_utils9.createProviderToolFactory)({
|
|
2998
3107
|
id: "google.google_maps",
|
|
2999
|
-
inputSchema: (0, import_provider_utils9.lazySchema)(() => (0, import_provider_utils9.zodSchema)(
|
|
3108
|
+
inputSchema: (0, import_provider_utils9.lazySchema)(() => (0, import_provider_utils9.zodSchema)(import_v48.z.object({})))
|
|
3000
3109
|
});
|
|
3001
3110
|
|
|
3002
3111
|
// src/tool/google-search.ts
|
|
3003
3112
|
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
3004
|
-
var
|
|
3005
|
-
var googleSearchToolArgsBaseSchema = () =>
|
|
3006
|
-
searchTypes:
|
|
3007
|
-
webSearch:
|
|
3008
|
-
imageSearch:
|
|
3113
|
+
var import_v49 = require("zod/v4");
|
|
3114
|
+
var googleSearchToolArgsBaseSchema = () => import_v49.z.object({
|
|
3115
|
+
searchTypes: import_v49.z.object({
|
|
3116
|
+
webSearch: import_v49.z.object({}).optional(),
|
|
3117
|
+
imageSearch: import_v49.z.object({}).optional()
|
|
3009
3118
|
}).optional(),
|
|
3010
|
-
timeRangeFilter:
|
|
3011
|
-
startTime:
|
|
3012
|
-
endTime:
|
|
3119
|
+
timeRangeFilter: import_v49.z.object({
|
|
3120
|
+
startTime: import_v49.z.string(),
|
|
3121
|
+
endTime: import_v49.z.string()
|
|
3013
3122
|
}).optional()
|
|
3014
3123
|
}).passthrough();
|
|
3015
3124
|
var googleSearchToolArgsSchema = (0, import_provider_utils10.lazySchema)(
|
|
@@ -3024,20 +3133,20 @@ var googleSearch = (0, import_provider_utils10.createProviderToolFactory)(
|
|
|
3024
3133
|
|
|
3025
3134
|
// src/tool/url-context.ts
|
|
3026
3135
|
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
3027
|
-
var
|
|
3136
|
+
var import_v410 = require("zod/v4");
|
|
3028
3137
|
var urlContext = (0, import_provider_utils11.createProviderToolFactory)({
|
|
3029
3138
|
id: "google.url_context",
|
|
3030
|
-
inputSchema: (0, import_provider_utils11.lazySchema)(() => (0, import_provider_utils11.zodSchema)(
|
|
3139
|
+
inputSchema: (0, import_provider_utils11.lazySchema)(() => (0, import_provider_utils11.zodSchema)(import_v410.z.object({})))
|
|
3031
3140
|
});
|
|
3032
3141
|
|
|
3033
3142
|
// src/tool/vertex-rag-store.ts
|
|
3034
3143
|
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
3035
|
-
var
|
|
3144
|
+
var import_v411 = require("zod/v4");
|
|
3036
3145
|
var vertexRagStore = (0, import_provider_utils12.createProviderToolFactory)({
|
|
3037
3146
|
id: "google.vertex_rag_store",
|
|
3038
|
-
inputSchema:
|
|
3039
|
-
ragCorpus:
|
|
3040
|
-
topK:
|
|
3147
|
+
inputSchema: import_v411.z.object({
|
|
3148
|
+
ragCorpus: import_v411.z.string(),
|
|
3149
|
+
topK: import_v411.z.number().optional()
|
|
3041
3150
|
})
|
|
3042
3151
|
});
|
|
3043
3152
|
|
|
@@ -4259,30 +4368,30 @@ ${block.text}`
|
|
|
4259
4368
|
|
|
4260
4369
|
// src/interactions/google-interactions-api.ts
|
|
4261
4370
|
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
4262
|
-
var
|
|
4263
|
-
var tokenByModalitySchema = () =>
|
|
4264
|
-
modality:
|
|
4265
|
-
tokens:
|
|
4371
|
+
var import_v412 = require("zod/v4");
|
|
4372
|
+
var tokenByModalitySchema = () => import_v412.z.object({
|
|
4373
|
+
modality: import_v412.z.string().nullish(),
|
|
4374
|
+
tokens: import_v412.z.number().nullish()
|
|
4266
4375
|
}).loose();
|
|
4267
|
-
var usageSchema2 = () =>
|
|
4268
|
-
total_input_tokens:
|
|
4269
|
-
total_output_tokens:
|
|
4270
|
-
total_thought_tokens:
|
|
4271
|
-
total_cached_tokens:
|
|
4272
|
-
total_tool_use_tokens:
|
|
4273
|
-
total_tokens:
|
|
4274
|
-
input_tokens_by_modality:
|
|
4275
|
-
output_tokens_by_modality:
|
|
4276
|
-
cached_tokens_by_modality:
|
|
4277
|
-
tool_use_tokens_by_modality:
|
|
4278
|
-
grounding_tool_count:
|
|
4279
|
-
|
|
4280
|
-
type:
|
|
4281
|
-
count:
|
|
4376
|
+
var usageSchema2 = () => import_v412.z.object({
|
|
4377
|
+
total_input_tokens: import_v412.z.number().nullish(),
|
|
4378
|
+
total_output_tokens: import_v412.z.number().nullish(),
|
|
4379
|
+
total_thought_tokens: import_v412.z.number().nullish(),
|
|
4380
|
+
total_cached_tokens: import_v412.z.number().nullish(),
|
|
4381
|
+
total_tool_use_tokens: import_v412.z.number().nullish(),
|
|
4382
|
+
total_tokens: import_v412.z.number().nullish(),
|
|
4383
|
+
input_tokens_by_modality: import_v412.z.array(tokenByModalitySchema()).nullish(),
|
|
4384
|
+
output_tokens_by_modality: import_v412.z.array(tokenByModalitySchema()).nullish(),
|
|
4385
|
+
cached_tokens_by_modality: import_v412.z.array(tokenByModalitySchema()).nullish(),
|
|
4386
|
+
tool_use_tokens_by_modality: import_v412.z.array(tokenByModalitySchema()).nullish(),
|
|
4387
|
+
grounding_tool_count: import_v412.z.array(
|
|
4388
|
+
import_v412.z.object({
|
|
4389
|
+
type: import_v412.z.string().nullish(),
|
|
4390
|
+
count: import_v412.z.number().nullish()
|
|
4282
4391
|
}).loose()
|
|
4283
4392
|
).nullish()
|
|
4284
4393
|
}).loose();
|
|
4285
|
-
var interactionStatusSchema = () =>
|
|
4394
|
+
var interactionStatusSchema = () => import_v412.z.enum([
|
|
4286
4395
|
"in_progress",
|
|
4287
4396
|
"requires_action",
|
|
4288
4397
|
"completed",
|
|
@@ -4291,69 +4400,69 @@ var interactionStatusSchema = () => import_v411.z.enum([
|
|
|
4291
4400
|
"incomplete"
|
|
4292
4401
|
]);
|
|
4293
4402
|
var annotationSchema = () => {
|
|
4294
|
-
const urlCitation =
|
|
4295
|
-
type:
|
|
4296
|
-
url:
|
|
4297
|
-
title:
|
|
4298
|
-
start_index:
|
|
4299
|
-
end_index:
|
|
4403
|
+
const urlCitation = import_v412.z.object({
|
|
4404
|
+
type: import_v412.z.literal("url_citation"),
|
|
4405
|
+
url: import_v412.z.string().nullish(),
|
|
4406
|
+
title: import_v412.z.string().nullish(),
|
|
4407
|
+
start_index: import_v412.z.number().nullish(),
|
|
4408
|
+
end_index: import_v412.z.number().nullish()
|
|
4300
4409
|
}).loose();
|
|
4301
|
-
const fileCitation =
|
|
4302
|
-
type:
|
|
4303
|
-
file_name:
|
|
4304
|
-
document_uri:
|
|
4305
|
-
url:
|
|
4306
|
-
page_number:
|
|
4307
|
-
media_id:
|
|
4308
|
-
start_index:
|
|
4309
|
-
end_index:
|
|
4310
|
-
custom_metadata:
|
|
4410
|
+
const fileCitation = import_v412.z.object({
|
|
4411
|
+
type: import_v412.z.literal("file_citation"),
|
|
4412
|
+
file_name: import_v412.z.string().nullish(),
|
|
4413
|
+
document_uri: import_v412.z.string().nullish(),
|
|
4414
|
+
url: import_v412.z.string().nullish(),
|
|
4415
|
+
page_number: import_v412.z.number().nullish(),
|
|
4416
|
+
media_id: import_v412.z.string().nullish(),
|
|
4417
|
+
start_index: import_v412.z.number().nullish(),
|
|
4418
|
+
end_index: import_v412.z.number().nullish(),
|
|
4419
|
+
custom_metadata: import_v412.z.record(import_v412.z.string(), import_v412.z.unknown()).nullish()
|
|
4311
4420
|
}).loose();
|
|
4312
|
-
const placeCitation =
|
|
4313
|
-
type:
|
|
4314
|
-
name:
|
|
4315
|
-
url:
|
|
4316
|
-
place_id:
|
|
4317
|
-
start_index:
|
|
4318
|
-
end_index:
|
|
4421
|
+
const placeCitation = import_v412.z.object({
|
|
4422
|
+
type: import_v412.z.literal("place_citation"),
|
|
4423
|
+
name: import_v412.z.string().nullish(),
|
|
4424
|
+
url: import_v412.z.string().nullish(),
|
|
4425
|
+
place_id: import_v412.z.string().nullish(),
|
|
4426
|
+
start_index: import_v412.z.number().nullish(),
|
|
4427
|
+
end_index: import_v412.z.number().nullish()
|
|
4319
4428
|
}).loose();
|
|
4320
|
-
return
|
|
4429
|
+
return import_v412.z.union([
|
|
4321
4430
|
urlCitation,
|
|
4322
4431
|
fileCitation,
|
|
4323
4432
|
placeCitation,
|
|
4324
|
-
|
|
4433
|
+
import_v412.z.object({ type: import_v412.z.string() }).loose()
|
|
4325
4434
|
]);
|
|
4326
4435
|
};
|
|
4327
|
-
var thoughtSummaryItemSchema = () =>
|
|
4328
|
-
type:
|
|
4329
|
-
text:
|
|
4330
|
-
data:
|
|
4331
|
-
mime_type:
|
|
4436
|
+
var thoughtSummaryItemSchema = () => import_v412.z.object({
|
|
4437
|
+
type: import_v412.z.string(),
|
|
4438
|
+
text: import_v412.z.string().nullish(),
|
|
4439
|
+
data: import_v412.z.string().nullish(),
|
|
4440
|
+
mime_type: import_v412.z.string().nullish()
|
|
4332
4441
|
}).loose();
|
|
4333
4442
|
var contentBlockSchema = () => {
|
|
4334
|
-
const textContent =
|
|
4335
|
-
type:
|
|
4336
|
-
text:
|
|
4337
|
-
annotations:
|
|
4443
|
+
const textContent = import_v412.z.object({
|
|
4444
|
+
type: import_v412.z.literal("text"),
|
|
4445
|
+
text: import_v412.z.string(),
|
|
4446
|
+
annotations: import_v412.z.array(annotationSchema()).nullish()
|
|
4338
4447
|
}).loose();
|
|
4339
|
-
const imageContent =
|
|
4340
|
-
type:
|
|
4341
|
-
data:
|
|
4342
|
-
mime_type:
|
|
4343
|
-
resolution:
|
|
4344
|
-
uri:
|
|
4448
|
+
const imageContent = import_v412.z.object({
|
|
4449
|
+
type: import_v412.z.literal("image"),
|
|
4450
|
+
data: import_v412.z.string().nullish(),
|
|
4451
|
+
mime_type: import_v412.z.string().nullish(),
|
|
4452
|
+
resolution: import_v412.z.enum(["low", "medium", "high", "ultra_high"]).nullish(),
|
|
4453
|
+
uri: import_v412.z.string().nullish()
|
|
4345
4454
|
}).loose();
|
|
4346
|
-
const videoContent =
|
|
4347
|
-
type:
|
|
4348
|
-
data:
|
|
4349
|
-
mime_type:
|
|
4350
|
-
uri:
|
|
4455
|
+
const videoContent = import_v412.z.object({
|
|
4456
|
+
type: import_v412.z.literal("video"),
|
|
4457
|
+
data: import_v412.z.string().nullish(),
|
|
4458
|
+
mime_type: import_v412.z.string().nullish(),
|
|
4459
|
+
uri: import_v412.z.string().nullish()
|
|
4351
4460
|
}).loose();
|
|
4352
|
-
return
|
|
4461
|
+
return import_v412.z.union([
|
|
4353
4462
|
textContent,
|
|
4354
4463
|
imageContent,
|
|
4355
4464
|
videoContent,
|
|
4356
|
-
|
|
4465
|
+
import_v412.z.object({ type: import_v412.z.string() }).loose()
|
|
4357
4466
|
]);
|
|
4358
4467
|
};
|
|
4359
4468
|
var BUILTIN_TOOL_CALL_STEP_TYPES = [
|
|
@@ -4373,73 +4482,73 @@ var BUILTIN_TOOL_RESULT_STEP_TYPES = [
|
|
|
4373
4482
|
"mcp_server_tool_result"
|
|
4374
4483
|
];
|
|
4375
4484
|
var stepSchema = () => {
|
|
4376
|
-
const userInputStep =
|
|
4377
|
-
type:
|
|
4378
|
-
content:
|
|
4485
|
+
const userInputStep = import_v412.z.object({
|
|
4486
|
+
type: import_v412.z.literal("user_input"),
|
|
4487
|
+
content: import_v412.z.array(contentBlockSchema()).nullish()
|
|
4379
4488
|
}).loose();
|
|
4380
|
-
const modelOutputStep =
|
|
4381
|
-
type:
|
|
4382
|
-
content:
|
|
4489
|
+
const modelOutputStep = import_v412.z.object({
|
|
4490
|
+
type: import_v412.z.literal("model_output"),
|
|
4491
|
+
content: import_v412.z.array(contentBlockSchema()).nullish()
|
|
4383
4492
|
}).loose();
|
|
4384
|
-
const functionCallStep =
|
|
4385
|
-
type:
|
|
4386
|
-
id:
|
|
4387
|
-
name:
|
|
4388
|
-
arguments:
|
|
4389
|
-
signature:
|
|
4493
|
+
const functionCallStep = import_v412.z.object({
|
|
4494
|
+
type: import_v412.z.literal("function_call"),
|
|
4495
|
+
id: import_v412.z.string(),
|
|
4496
|
+
name: import_v412.z.string(),
|
|
4497
|
+
arguments: import_v412.z.record(import_v412.z.string(), import_v412.z.unknown()).nullish(),
|
|
4498
|
+
signature: import_v412.z.string().nullish()
|
|
4390
4499
|
}).loose();
|
|
4391
|
-
const thoughtStep =
|
|
4392
|
-
type:
|
|
4393
|
-
signature:
|
|
4394
|
-
summary:
|
|
4500
|
+
const thoughtStep = import_v412.z.object({
|
|
4501
|
+
type: import_v412.z.literal("thought"),
|
|
4502
|
+
signature: import_v412.z.string().nullish(),
|
|
4503
|
+
summary: import_v412.z.array(thoughtSummaryItemSchema()).nullish()
|
|
4395
4504
|
}).loose();
|
|
4396
|
-
const builtinToolCallStep =
|
|
4397
|
-
type:
|
|
4398
|
-
id:
|
|
4399
|
-
arguments:
|
|
4400
|
-
name:
|
|
4401
|
-
server_name:
|
|
4402
|
-
search_type:
|
|
4403
|
-
signature:
|
|
4505
|
+
const builtinToolCallStep = import_v412.z.object({
|
|
4506
|
+
type: import_v412.z.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
|
|
4507
|
+
id: import_v412.z.string(),
|
|
4508
|
+
arguments: import_v412.z.record(import_v412.z.string(), import_v412.z.unknown()).nullish(),
|
|
4509
|
+
name: import_v412.z.string().nullish(),
|
|
4510
|
+
server_name: import_v412.z.string().nullish(),
|
|
4511
|
+
search_type: import_v412.z.string().nullish(),
|
|
4512
|
+
signature: import_v412.z.string().nullish()
|
|
4404
4513
|
}).loose();
|
|
4405
|
-
const builtinToolResultStep =
|
|
4406
|
-
type:
|
|
4407
|
-
call_id:
|
|
4408
|
-
result:
|
|
4409
|
-
is_error:
|
|
4410
|
-
name:
|
|
4411
|
-
server_name:
|
|
4412
|
-
signature:
|
|
4514
|
+
const builtinToolResultStep = import_v412.z.object({
|
|
4515
|
+
type: import_v412.z.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
|
|
4516
|
+
call_id: import_v412.z.string(),
|
|
4517
|
+
result: import_v412.z.unknown().nullish(),
|
|
4518
|
+
is_error: import_v412.z.boolean().nullish(),
|
|
4519
|
+
name: import_v412.z.string().nullish(),
|
|
4520
|
+
server_name: import_v412.z.string().nullish(),
|
|
4521
|
+
signature: import_v412.z.string().nullish()
|
|
4413
4522
|
}).loose();
|
|
4414
|
-
return
|
|
4523
|
+
return import_v412.z.union([
|
|
4415
4524
|
userInputStep,
|
|
4416
4525
|
modelOutputStep,
|
|
4417
4526
|
functionCallStep,
|
|
4418
4527
|
thoughtStep,
|
|
4419
4528
|
builtinToolCallStep,
|
|
4420
4529
|
builtinToolResultStep,
|
|
4421
|
-
|
|
4530
|
+
import_v412.z.object({ type: import_v412.z.string() }).loose()
|
|
4422
4531
|
]);
|
|
4423
4532
|
};
|
|
4424
4533
|
var googleInteractionsResponseSchema = (0, import_provider_utils14.lazySchema)(
|
|
4425
4534
|
() => (0, import_provider_utils14.zodSchema)(
|
|
4426
|
-
|
|
4535
|
+
import_v412.z.object({
|
|
4427
4536
|
/*
|
|
4428
4537
|
* `id` is omitted from the response body when `store: false` (fully
|
|
4429
4538
|
* stateless mode) — there is no server-side interaction record for the
|
|
4430
4539
|
* client to reference. `nullish` lets the schema accept that shape.
|
|
4431
4540
|
*/
|
|
4432
|
-
id:
|
|
4433
|
-
created:
|
|
4434
|
-
updated:
|
|
4541
|
+
id: import_v412.z.string().nullish(),
|
|
4542
|
+
created: import_v412.z.string().nullish(),
|
|
4543
|
+
updated: import_v412.z.string().nullish(),
|
|
4435
4544
|
status: interactionStatusSchema(),
|
|
4436
|
-
model:
|
|
4437
|
-
agent:
|
|
4438
|
-
steps:
|
|
4545
|
+
model: import_v412.z.string().nullish(),
|
|
4546
|
+
agent: import_v412.z.string().nullish(),
|
|
4547
|
+
steps: import_v412.z.array(stepSchema()).nullish(),
|
|
4439
4548
|
usage: usageSchema2().nullish(),
|
|
4440
|
-
service_tier:
|
|
4441
|
-
previous_interaction_id:
|
|
4442
|
-
response_modalities:
|
|
4549
|
+
service_tier: import_v412.z.string().nullish(),
|
|
4550
|
+
previous_interaction_id: import_v412.z.string().nullish(),
|
|
4551
|
+
response_modalities: import_v412.z.array(import_v412.z.string()).nullish()
|
|
4443
4552
|
}).loose()
|
|
4444
4553
|
)
|
|
4445
4554
|
);
|
|
@@ -4449,82 +4558,82 @@ var googleInteractionsEventSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
4449
4558
|
const status = interactionStatusSchema();
|
|
4450
4559
|
const annotation = annotationSchema();
|
|
4451
4560
|
const thoughtSummaryItem = thoughtSummaryItemSchema();
|
|
4452
|
-
const interactionCreatedEvent =
|
|
4453
|
-
event_type:
|
|
4454
|
-
event_id:
|
|
4455
|
-
interaction:
|
|
4561
|
+
const interactionCreatedEvent = import_v412.z.object({
|
|
4562
|
+
event_type: import_v412.z.literal("interaction.created"),
|
|
4563
|
+
event_id: import_v412.z.string().nullish(),
|
|
4564
|
+
interaction: import_v412.z.object({
|
|
4456
4565
|
/*
|
|
4457
4566
|
* `id` is omitted when `store: false` (fully stateless mode);
|
|
4458
4567
|
* see the matching note on `googleInteractionsResponseSchema.id`.
|
|
4459
4568
|
*/
|
|
4460
|
-
id:
|
|
4461
|
-
created:
|
|
4462
|
-
model:
|
|
4463
|
-
agent:
|
|
4569
|
+
id: import_v412.z.string().nullish(),
|
|
4570
|
+
created: import_v412.z.string().nullish(),
|
|
4571
|
+
model: import_v412.z.string().nullish(),
|
|
4572
|
+
agent: import_v412.z.string().nullish(),
|
|
4464
4573
|
status: status.nullish()
|
|
4465
4574
|
}).loose()
|
|
4466
4575
|
}).loose();
|
|
4467
|
-
const stepStartEvent =
|
|
4468
|
-
event_type:
|
|
4469
|
-
event_id:
|
|
4470
|
-
index:
|
|
4576
|
+
const stepStartEvent = import_v412.z.object({
|
|
4577
|
+
event_type: import_v412.z.literal("step.start"),
|
|
4578
|
+
event_id: import_v412.z.string().nullish(),
|
|
4579
|
+
index: import_v412.z.number(),
|
|
4471
4580
|
step: stepSchema()
|
|
4472
4581
|
}).loose();
|
|
4473
|
-
const stepDeltaText =
|
|
4474
|
-
type:
|
|
4475
|
-
text:
|
|
4582
|
+
const stepDeltaText = import_v412.z.object({
|
|
4583
|
+
type: import_v412.z.literal("text"),
|
|
4584
|
+
text: import_v412.z.string()
|
|
4476
4585
|
}).loose();
|
|
4477
|
-
const stepDeltaThoughtSummary =
|
|
4478
|
-
type:
|
|
4586
|
+
const stepDeltaThoughtSummary = import_v412.z.object({
|
|
4587
|
+
type: import_v412.z.literal("thought_summary"),
|
|
4479
4588
|
content: thoughtSummaryItem.nullish()
|
|
4480
4589
|
}).loose();
|
|
4481
|
-
const stepDeltaThoughtSignature =
|
|
4482
|
-
type:
|
|
4483
|
-
signature:
|
|
4590
|
+
const stepDeltaThoughtSignature = import_v412.z.object({
|
|
4591
|
+
type: import_v412.z.literal("thought_signature"),
|
|
4592
|
+
signature: import_v412.z.string().nullish()
|
|
4484
4593
|
}).loose();
|
|
4485
|
-
const stepDeltaArgumentsDelta =
|
|
4486
|
-
type:
|
|
4487
|
-
arguments:
|
|
4488
|
-
id:
|
|
4489
|
-
signature:
|
|
4594
|
+
const stepDeltaArgumentsDelta = import_v412.z.object({
|
|
4595
|
+
type: import_v412.z.literal("arguments_delta"),
|
|
4596
|
+
arguments: import_v412.z.string().nullish(),
|
|
4597
|
+
id: import_v412.z.string().nullish(),
|
|
4598
|
+
signature: import_v412.z.string().nullish()
|
|
4490
4599
|
}).loose();
|
|
4491
|
-
const stepDeltaTextAnnotation =
|
|
4492
|
-
type:
|
|
4493
|
-
annotations:
|
|
4600
|
+
const stepDeltaTextAnnotation = import_v412.z.object({
|
|
4601
|
+
type: import_v412.z.enum(["text_annotation_delta", "text_annotation"]),
|
|
4602
|
+
annotations: import_v412.z.array(annotation).nullish()
|
|
4494
4603
|
}).loose();
|
|
4495
|
-
const stepDeltaImage =
|
|
4496
|
-
type:
|
|
4497
|
-
data:
|
|
4498
|
-
mime_type:
|
|
4499
|
-
resolution:
|
|
4500
|
-
uri:
|
|
4604
|
+
const stepDeltaImage = import_v412.z.object({
|
|
4605
|
+
type: import_v412.z.literal("image"),
|
|
4606
|
+
data: import_v412.z.string().nullish(),
|
|
4607
|
+
mime_type: import_v412.z.string().nullish(),
|
|
4608
|
+
resolution: import_v412.z.enum(["low", "medium", "high", "ultra_high"]).nullish(),
|
|
4609
|
+
uri: import_v412.z.string().nullish()
|
|
4501
4610
|
}).loose();
|
|
4502
|
-
const stepDeltaVideo =
|
|
4503
|
-
type:
|
|
4504
|
-
data:
|
|
4505
|
-
mime_type:
|
|
4506
|
-
uri:
|
|
4611
|
+
const stepDeltaVideo = import_v412.z.object({
|
|
4612
|
+
type: import_v412.z.literal("video"),
|
|
4613
|
+
data: import_v412.z.string().nullish(),
|
|
4614
|
+
mime_type: import_v412.z.string().nullish(),
|
|
4615
|
+
uri: import_v412.z.string().nullish()
|
|
4507
4616
|
}).loose();
|
|
4508
|
-
const stepDeltaBuiltinToolCall =
|
|
4509
|
-
type:
|
|
4510
|
-
id:
|
|
4511
|
-
arguments:
|
|
4512
|
-
name:
|
|
4513
|
-
server_name:
|
|
4514
|
-
search_type:
|
|
4515
|
-
signature:
|
|
4617
|
+
const stepDeltaBuiltinToolCall = import_v412.z.object({
|
|
4618
|
+
type: import_v412.z.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
|
|
4619
|
+
id: import_v412.z.string().nullish(),
|
|
4620
|
+
arguments: import_v412.z.record(import_v412.z.string(), import_v412.z.unknown()).nullish(),
|
|
4621
|
+
name: import_v412.z.string().nullish(),
|
|
4622
|
+
server_name: import_v412.z.string().nullish(),
|
|
4623
|
+
search_type: import_v412.z.string().nullish(),
|
|
4624
|
+
signature: import_v412.z.string().nullish()
|
|
4516
4625
|
}).loose();
|
|
4517
|
-
const stepDeltaBuiltinToolResult =
|
|
4518
|
-
type:
|
|
4519
|
-
call_id:
|
|
4520
|
-
result:
|
|
4521
|
-
is_error:
|
|
4522
|
-
name:
|
|
4523
|
-
server_name:
|
|
4524
|
-
signature:
|
|
4626
|
+
const stepDeltaBuiltinToolResult = import_v412.z.object({
|
|
4627
|
+
type: import_v412.z.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
|
|
4628
|
+
call_id: import_v412.z.string().nullish(),
|
|
4629
|
+
result: import_v412.z.unknown().nullish(),
|
|
4630
|
+
is_error: import_v412.z.boolean().nullish(),
|
|
4631
|
+
name: import_v412.z.string().nullish(),
|
|
4632
|
+
server_name: import_v412.z.string().nullish(),
|
|
4633
|
+
signature: import_v412.z.string().nullish()
|
|
4525
4634
|
}).loose();
|
|
4526
|
-
const stepDeltaUnknown =
|
|
4527
|
-
const stepDeltaUnion =
|
|
4635
|
+
const stepDeltaUnknown = import_v412.z.object({ type: import_v412.z.string() }).loose();
|
|
4636
|
+
const stepDeltaUnion = import_v412.z.union([
|
|
4528
4637
|
stepDeltaText,
|
|
4529
4638
|
stepDeltaImage,
|
|
4530
4639
|
stepDeltaVideo,
|
|
@@ -4536,55 +4645,55 @@ var googleInteractionsEventSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
4536
4645
|
stepDeltaBuiltinToolResult,
|
|
4537
4646
|
stepDeltaUnknown
|
|
4538
4647
|
]);
|
|
4539
|
-
const stepDeltaEvent =
|
|
4540
|
-
event_type:
|
|
4541
|
-
event_id:
|
|
4542
|
-
index:
|
|
4648
|
+
const stepDeltaEvent = import_v412.z.object({
|
|
4649
|
+
event_type: import_v412.z.literal("step.delta"),
|
|
4650
|
+
event_id: import_v412.z.string().nullish(),
|
|
4651
|
+
index: import_v412.z.number(),
|
|
4543
4652
|
delta: stepDeltaUnion
|
|
4544
4653
|
}).loose();
|
|
4545
|
-
const stepStopEvent =
|
|
4546
|
-
event_type:
|
|
4547
|
-
event_id:
|
|
4548
|
-
index:
|
|
4654
|
+
const stepStopEvent = import_v412.z.object({
|
|
4655
|
+
event_type: import_v412.z.literal("step.stop"),
|
|
4656
|
+
event_id: import_v412.z.string().nullish(),
|
|
4657
|
+
index: import_v412.z.number()
|
|
4549
4658
|
}).loose();
|
|
4550
|
-
const interactionStatusUpdateEvent =
|
|
4551
|
-
event_type:
|
|
4552
|
-
event_id:
|
|
4553
|
-
interaction_id:
|
|
4659
|
+
const interactionStatusUpdateEvent = import_v412.z.object({
|
|
4660
|
+
event_type: import_v412.z.literal("interaction.status_update"),
|
|
4661
|
+
event_id: import_v412.z.string().nullish(),
|
|
4662
|
+
interaction_id: import_v412.z.string().nullish(),
|
|
4554
4663
|
status: status.nullish()
|
|
4555
4664
|
}).loose();
|
|
4556
|
-
const interactionInProgressEvent =
|
|
4557
|
-
event_type:
|
|
4558
|
-
event_id:
|
|
4559
|
-
interaction_id:
|
|
4665
|
+
const interactionInProgressEvent = import_v412.z.object({
|
|
4666
|
+
event_type: import_v412.z.literal("interaction.in_progress"),
|
|
4667
|
+
event_id: import_v412.z.string().nullish(),
|
|
4668
|
+
interaction_id: import_v412.z.string().nullish(),
|
|
4560
4669
|
status: status.nullish()
|
|
4561
4670
|
}).loose();
|
|
4562
|
-
const interactionRequiresActionEvent =
|
|
4563
|
-
event_type:
|
|
4564
|
-
event_id:
|
|
4565
|
-
interaction_id:
|
|
4671
|
+
const interactionRequiresActionEvent = import_v412.z.object({
|
|
4672
|
+
event_type: import_v412.z.literal("interaction.requires_action"),
|
|
4673
|
+
event_id: import_v412.z.string().nullish(),
|
|
4674
|
+
interaction_id: import_v412.z.string().nullish(),
|
|
4566
4675
|
status: status.nullish()
|
|
4567
4676
|
}).loose();
|
|
4568
|
-
const interactionCompletedEvent =
|
|
4569
|
-
event_type:
|
|
4570
|
-
event_id:
|
|
4571
|
-
interaction:
|
|
4572
|
-
id:
|
|
4677
|
+
const interactionCompletedEvent = import_v412.z.object({
|
|
4678
|
+
event_type: import_v412.z.literal("interaction.completed"),
|
|
4679
|
+
event_id: import_v412.z.string().nullish(),
|
|
4680
|
+
interaction: import_v412.z.object({
|
|
4681
|
+
id: import_v412.z.string().nullish(),
|
|
4573
4682
|
status: status.nullish(),
|
|
4574
4683
|
usage: usageSchema2().nullish(),
|
|
4575
|
-
service_tier:
|
|
4684
|
+
service_tier: import_v412.z.string().nullish()
|
|
4576
4685
|
}).loose()
|
|
4577
4686
|
}).loose();
|
|
4578
|
-
const errorEvent =
|
|
4579
|
-
event_type:
|
|
4580
|
-
event_id:
|
|
4581
|
-
error:
|
|
4582
|
-
code:
|
|
4583
|
-
message:
|
|
4687
|
+
const errorEvent = import_v412.z.object({
|
|
4688
|
+
event_type: import_v412.z.literal("error"),
|
|
4689
|
+
event_id: import_v412.z.string().nullish(),
|
|
4690
|
+
error: import_v412.z.object({
|
|
4691
|
+
code: import_v412.z.string().nullish(),
|
|
4692
|
+
message: import_v412.z.string().nullish()
|
|
4584
4693
|
}).loose().nullish()
|
|
4585
4694
|
}).loose();
|
|
4586
|
-
const unknownEvent =
|
|
4587
|
-
return
|
|
4695
|
+
const unknownEvent = import_v412.z.object({ event_type: import_v412.z.string() }).loose();
|
|
4696
|
+
return import_v412.z.union([
|
|
4588
4697
|
interactionCreatedEvent,
|
|
4589
4698
|
stepStartEvent,
|
|
4590
4699
|
stepDeltaEvent,
|
|
@@ -4602,26 +4711,26 @@ var googleInteractionsEventSchema = (0, import_provider_utils14.lazySchema)(
|
|
|
4602
4711
|
|
|
4603
4712
|
// src/interactions/google-interactions-language-model-options.ts
|
|
4604
4713
|
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
4605
|
-
var
|
|
4714
|
+
var import_v413 = require("zod/v4");
|
|
4606
4715
|
var googleInteractionsLanguageModelOptions = (0, import_provider_utils15.lazySchema)(
|
|
4607
4716
|
() => (0, import_provider_utils15.zodSchema)(
|
|
4608
|
-
|
|
4609
|
-
previousInteractionId:
|
|
4610
|
-
store:
|
|
4611
|
-
agent:
|
|
4612
|
-
agentConfig:
|
|
4613
|
-
|
|
4614
|
-
type:
|
|
4717
|
+
import_v413.z.object({
|
|
4718
|
+
previousInteractionId: import_v413.z.string().nullish(),
|
|
4719
|
+
store: import_v413.z.boolean().nullish(),
|
|
4720
|
+
agent: import_v413.z.string().nullish(),
|
|
4721
|
+
agentConfig: import_v413.z.union([
|
|
4722
|
+
import_v413.z.object({
|
|
4723
|
+
type: import_v413.z.literal("dynamic")
|
|
4615
4724
|
}).loose(),
|
|
4616
|
-
|
|
4617
|
-
type:
|
|
4618
|
-
thinkingSummaries:
|
|
4619
|
-
visualization:
|
|
4620
|
-
collaborativePlanning:
|
|
4725
|
+
import_v413.z.object({
|
|
4726
|
+
type: import_v413.z.literal("deep-research"),
|
|
4727
|
+
thinkingSummaries: import_v413.z.enum(["auto", "none"]).nullish(),
|
|
4728
|
+
visualization: import_v413.z.enum(["off", "auto"]).nullish(),
|
|
4729
|
+
collaborativePlanning: import_v413.z.boolean().nullish()
|
|
4621
4730
|
})
|
|
4622
4731
|
]).nullish(),
|
|
4623
|
-
thinkingLevel:
|
|
4624
|
-
thinkingSummaries:
|
|
4732
|
+
thinkingLevel: import_v413.z.enum(["minimal", "low", "medium", "high"]).nullish(),
|
|
4733
|
+
thinkingSummaries: import_v413.z.enum(["auto", "none"]).nullish(),
|
|
4625
4734
|
/**
|
|
4626
4735
|
* Output-format entries that map directly to the API's `response_format`
|
|
4627
4736
|
* array. Use this to request image, audio, video, or non-JSON text
|
|
@@ -4631,17 +4740,17 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils15.lazySch
|
|
|
4631
4740
|
* type: 'json', schema }` still drives JSON-mode and adds a matching
|
|
4632
4741
|
* text entry automatically; entries listed here are appended.
|
|
4633
4742
|
*/
|
|
4634
|
-
responseFormat:
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
type:
|
|
4638
|
-
mimeType:
|
|
4639
|
-
schema:
|
|
4743
|
+
responseFormat: import_v413.z.array(
|
|
4744
|
+
import_v413.z.union([
|
|
4745
|
+
import_v413.z.object({
|
|
4746
|
+
type: import_v413.z.literal("text"),
|
|
4747
|
+
mimeType: import_v413.z.string().nullish(),
|
|
4748
|
+
schema: import_v413.z.unknown().nullish()
|
|
4640
4749
|
}).loose(),
|
|
4641
|
-
|
|
4642
|
-
type:
|
|
4643
|
-
mimeType:
|
|
4644
|
-
aspectRatio:
|
|
4750
|
+
import_v413.z.object({
|
|
4751
|
+
type: import_v413.z.literal("image"),
|
|
4752
|
+
mimeType: import_v413.z.string().nullish(),
|
|
4753
|
+
aspectRatio: import_v413.z.enum([
|
|
4645
4754
|
"1:1",
|
|
4646
4755
|
"2:3",
|
|
4647
4756
|
"3:2",
|
|
@@ -4657,19 +4766,19 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils15.lazySch
|
|
|
4657
4766
|
"1:4",
|
|
4658
4767
|
"4:1"
|
|
4659
4768
|
]).nullish(),
|
|
4660
|
-
imageSize:
|
|
4769
|
+
imageSize: import_v413.z.enum(["1K", "2K", "4K", "512"]).nullish()
|
|
4661
4770
|
}).loose(),
|
|
4662
|
-
|
|
4663
|
-
type:
|
|
4664
|
-
mimeType:
|
|
4771
|
+
import_v413.z.object({
|
|
4772
|
+
type: import_v413.z.literal("audio"),
|
|
4773
|
+
mimeType: import_v413.z.string().nullish()
|
|
4665
4774
|
}).loose(),
|
|
4666
|
-
|
|
4667
|
-
type:
|
|
4668
|
-
aspectRatio:
|
|
4669
|
-
resolution:
|
|
4670
|
-
duration:
|
|
4671
|
-
delivery:
|
|
4672
|
-
gcsUri:
|
|
4775
|
+
import_v413.z.object({
|
|
4776
|
+
type: import_v413.z.literal("video"),
|
|
4777
|
+
aspectRatio: import_v413.z.enum(["16:9", "9:16"]).nullish(),
|
|
4778
|
+
resolution: import_v413.z.enum(["360p", "720p", "1080p", "4k"]).nullish(),
|
|
4779
|
+
duration: import_v413.z.string().nullish(),
|
|
4780
|
+
delivery: import_v413.z.enum(["inline", "uri"]).nullish(),
|
|
4781
|
+
gcsUri: import_v413.z.string().nullish()
|
|
4673
4782
|
}).loose()
|
|
4674
4783
|
])
|
|
4675
4784
|
).nullish(),
|
|
@@ -4679,8 +4788,8 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils15.lazySch
|
|
|
4679
4788
|
* translates it into a matching `response_format` image entry and
|
|
4680
4789
|
* emits a warning when set.
|
|
4681
4790
|
*/
|
|
4682
|
-
imageConfig:
|
|
4683
|
-
aspectRatio:
|
|
4791
|
+
imageConfig: import_v413.z.object({
|
|
4792
|
+
aspectRatio: import_v413.z.enum([
|
|
4684
4793
|
"1:1",
|
|
4685
4794
|
"2:3",
|
|
4686
4795
|
"3:2",
|
|
@@ -4696,35 +4805,35 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils15.lazySch
|
|
|
4696
4805
|
"1:4",
|
|
4697
4806
|
"4:1"
|
|
4698
4807
|
]).nullish(),
|
|
4699
|
-
imageSize:
|
|
4808
|
+
imageSize: import_v413.z.enum(["1K", "2K", "4K", "512"]).nullish()
|
|
4700
4809
|
}).nullish(),
|
|
4701
|
-
mediaResolution:
|
|
4702
|
-
responseModalities:
|
|
4703
|
-
serviceTier:
|
|
4810
|
+
mediaResolution: import_v413.z.enum(["low", "medium", "high", "ultra_high"]).nullish(),
|
|
4811
|
+
responseModalities: import_v413.z.array(import_v413.z.enum(["text", "image", "audio", "video", "document"])).nullish(),
|
|
4812
|
+
serviceTier: import_v413.z.enum(["flex", "standard", "priority"]).nullish(),
|
|
4704
4813
|
/**
|
|
4705
4814
|
* Alternative to AI SDK `system` message. If both are set, the AI SDK
|
|
4706
4815
|
* `system` message wins and a warning is emitted.
|
|
4707
4816
|
*/
|
|
4708
|
-
systemInstruction:
|
|
4817
|
+
systemInstruction: import_v413.z.string().nullish(),
|
|
4709
4818
|
/**
|
|
4710
4819
|
* Per-block signature for round-tripping `thought.signature` and
|
|
4711
4820
|
* `function_call.signature` blocks. Set by the SDK on output reasoning /
|
|
4712
4821
|
* tool-call parts; passed back unchanged on input parts so the API
|
|
4713
4822
|
* accepts the prior turn.
|
|
4714
4823
|
*/
|
|
4715
|
-
signature:
|
|
4824
|
+
signature: import_v413.z.string().nullish(),
|
|
4716
4825
|
/**
|
|
4717
4826
|
* Set by the SDK on output assistant messages. The converter uses it to
|
|
4718
4827
|
* decide which messages to drop when compacting under
|
|
4719
4828
|
* `previousInteractionId`.
|
|
4720
4829
|
*/
|
|
4721
|
-
interactionId:
|
|
4830
|
+
interactionId: import_v413.z.string().nullish(),
|
|
4722
4831
|
/**
|
|
4723
4832
|
* Maximum time, in milliseconds, to poll a background interaction (agent
|
|
4724
4833
|
* call) before giving up. Defaults to 30 minutes. Long-running agents
|
|
4725
4834
|
* such as deep research can take tens of minutes — increase if needed.
|
|
4726
4835
|
*/
|
|
4727
|
-
pollingTimeoutMs:
|
|
4836
|
+
pollingTimeoutMs: import_v413.z.number().int().positive().nullish(),
|
|
4728
4837
|
/**
|
|
4729
4838
|
* Run the interaction in the background. Required for agents whose
|
|
4730
4839
|
* server-side workflow cannot complete within a single request/response.
|
|
@@ -4733,7 +4842,7 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils15.lazySch
|
|
|
4733
4842
|
* reject `true`; see the agent's documentation for which mode it
|
|
4734
4843
|
* requires.
|
|
4735
4844
|
*/
|
|
4736
|
-
background:
|
|
4845
|
+
background: import_v413.z.boolean().nullish(),
|
|
4737
4846
|
/**
|
|
4738
4847
|
* Environment configuration for the agent sandbox. Only applies to agent
|
|
4739
4848
|
* calls (`google.interactions({ agent })`); ignored on model-id calls.
|
|
@@ -4743,36 +4852,36 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils15.lazySch
|
|
|
4743
4852
|
* - object: provision a fresh sandbox and optionally preload `sources`
|
|
4744
4853
|
* and/or constrain outbound traffic via `network`.
|
|
4745
4854
|
*/
|
|
4746
|
-
environment:
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
type:
|
|
4750
|
-
sources:
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
type:
|
|
4754
|
-
source:
|
|
4755
|
-
target:
|
|
4855
|
+
environment: import_v413.z.union([
|
|
4856
|
+
import_v413.z.string(),
|
|
4857
|
+
import_v413.z.object({
|
|
4858
|
+
type: import_v413.z.literal("remote"),
|
|
4859
|
+
sources: import_v413.z.array(
|
|
4860
|
+
import_v413.z.union([
|
|
4861
|
+
import_v413.z.object({
|
|
4862
|
+
type: import_v413.z.literal("gcs"),
|
|
4863
|
+
source: import_v413.z.string(),
|
|
4864
|
+
target: import_v413.z.string().nullish()
|
|
4756
4865
|
}),
|
|
4757
|
-
|
|
4758
|
-
type:
|
|
4759
|
-
source:
|
|
4760
|
-
target:
|
|
4866
|
+
import_v413.z.object({
|
|
4867
|
+
type: import_v413.z.literal("repository"),
|
|
4868
|
+
source: import_v413.z.string(),
|
|
4869
|
+
target: import_v413.z.string().nullish()
|
|
4761
4870
|
}),
|
|
4762
|
-
|
|
4763
|
-
type:
|
|
4764
|
-
content:
|
|
4765
|
-
target:
|
|
4871
|
+
import_v413.z.object({
|
|
4872
|
+
type: import_v413.z.literal("inline"),
|
|
4873
|
+
content: import_v413.z.string(),
|
|
4874
|
+
target: import_v413.z.string()
|
|
4766
4875
|
})
|
|
4767
4876
|
])
|
|
4768
4877
|
).nullish(),
|
|
4769
|
-
network:
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
allowlist:
|
|
4773
|
-
|
|
4774
|
-
domain:
|
|
4775
|
-
transform:
|
|
4878
|
+
network: import_v413.z.union([
|
|
4879
|
+
import_v413.z.literal("disabled"),
|
|
4880
|
+
import_v413.z.object({
|
|
4881
|
+
allowlist: import_v413.z.array(
|
|
4882
|
+
import_v413.z.object({
|
|
4883
|
+
domain: import_v413.z.string(),
|
|
4884
|
+
transform: import_v413.z.array(import_v413.z.record(import_v413.z.string(), import_v413.z.string())).nullish()
|
|
4776
4885
|
})
|
|
4777
4886
|
)
|
|
4778
4887
|
})
|
|
@@ -5076,6 +5185,9 @@ function prepareGoogleInteractionsTools({
|
|
|
5076
5185
|
}) {
|
|
5077
5186
|
var _a, _b, _c, _d;
|
|
5078
5187
|
const toolWarnings = [];
|
|
5188
|
+
if ((toolChoice == null ? void 0 : toolChoice.type) === "none") {
|
|
5189
|
+
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
5190
|
+
}
|
|
5079
5191
|
const normalized = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
5080
5192
|
if (normalized == null) {
|
|
5081
5193
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
@@ -5197,9 +5309,6 @@ function prepareGoogleInteractionsTools({
|
|
|
5197
5309
|
case "required":
|
|
5198
5310
|
mappedToolChoice = "any";
|
|
5199
5311
|
break;
|
|
5200
|
-
case "none":
|
|
5201
|
-
mappedToolChoice = "none";
|
|
5202
|
-
break;
|
|
5203
5312
|
case "tool":
|
|
5204
5313
|
mappedToolChoice = {
|
|
5205
5314
|
allowed_tools: {
|