@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/index.js
CHANGED
|
@@ -35,15 +35,16 @@ var import_v43 = require("zod/v4");
|
|
|
35
35
|
// src/google-error.ts
|
|
36
36
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
37
37
|
var import_v4 = require("zod/v4");
|
|
38
|
+
var getGoogleErrorSchema = () => import_v4.z.object({
|
|
39
|
+
code: import_v4.z.number().nullable(),
|
|
40
|
+
message: import_v4.z.string(),
|
|
41
|
+
status: import_v4.z.string(),
|
|
42
|
+
details: import_v4.z.array(import_v4.z.unknown()).nullish()
|
|
43
|
+
});
|
|
38
44
|
var googleErrorDataSchema = (0, import_provider_utils.lazySchema)(
|
|
39
45
|
() => (0, import_provider_utils.zodSchema)(
|
|
40
46
|
import_v4.z.object({
|
|
41
|
-
error:
|
|
42
|
-
code: import_v4.z.number().nullable(),
|
|
43
|
-
message: import_v4.z.string(),
|
|
44
|
-
status: import_v4.z.string(),
|
|
45
|
-
details: import_v4.z.array(import_v4.z.unknown()).nullish()
|
|
46
|
-
})
|
|
47
|
+
error: getGoogleErrorSchema()
|
|
47
48
|
})
|
|
48
49
|
)
|
|
49
50
|
);
|
|
@@ -51,6 +52,39 @@ var googleFailedResponseHandler = (0, import_provider_utils.createJsonErrorRespo
|
|
|
51
52
|
errorSchema: googleErrorDataSchema,
|
|
52
53
|
errorToMessage: (data) => data.error.message
|
|
53
54
|
});
|
|
55
|
+
function mapGoogleErrorStatusToHttpStatusCode(status) {
|
|
56
|
+
switch (status) {
|
|
57
|
+
case "CANCELLED":
|
|
58
|
+
return 499;
|
|
59
|
+
case "INVALID_ARGUMENT":
|
|
60
|
+
case "FAILED_PRECONDITION":
|
|
61
|
+
case "OUT_OF_RANGE":
|
|
62
|
+
return 400;
|
|
63
|
+
case "DEADLINE_EXCEEDED":
|
|
64
|
+
return 504;
|
|
65
|
+
case "NOT_FOUND":
|
|
66
|
+
return 404;
|
|
67
|
+
case "ALREADY_EXISTS":
|
|
68
|
+
case "ABORTED":
|
|
69
|
+
return 409;
|
|
70
|
+
case "PERMISSION_DENIED":
|
|
71
|
+
return 403;
|
|
72
|
+
case "UNAUTHENTICATED":
|
|
73
|
+
return 401;
|
|
74
|
+
case "RESOURCE_EXHAUSTED":
|
|
75
|
+
return 429;
|
|
76
|
+
case "UNIMPLEMENTED":
|
|
77
|
+
return 501;
|
|
78
|
+
case "UNKNOWN":
|
|
79
|
+
case "INTERNAL":
|
|
80
|
+
case "DATA_LOSS":
|
|
81
|
+
return 500;
|
|
82
|
+
case "UNAVAILABLE":
|
|
83
|
+
return 503;
|
|
84
|
+
default:
|
|
85
|
+
return void 0;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
54
88
|
|
|
55
89
|
// src/transcription/google-transcription-model-options.ts
|
|
56
90
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
@@ -244,7 +278,7 @@ var googleInteractionsTranscriptionResponseSchema = (0, import_provider_utils3.l
|
|
|
244
278
|
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
245
279
|
|
|
246
280
|
// src/version.ts
|
|
247
|
-
var VERSION = true ? "3.0.
|
|
281
|
+
var VERSION = true ? "3.0.141" : "0.0.0-test";
|
|
248
282
|
|
|
249
283
|
// src/google-generative-ai-embedding-model.ts
|
|
250
284
|
var import_provider2 = require("@ai-sdk/provider");
|
|
@@ -466,8 +500,9 @@ function validateMultimodalContentLength({
|
|
|
466
500
|
}
|
|
467
501
|
|
|
468
502
|
// src/google-generative-ai-language-model.ts
|
|
503
|
+
var import_provider6 = require("@ai-sdk/provider");
|
|
469
504
|
var import_provider_utils9 = require("@ai-sdk/provider-utils");
|
|
470
|
-
var
|
|
505
|
+
var import_v48 = require("zod/v4");
|
|
471
506
|
|
|
472
507
|
// src/continue-google-stream.ts
|
|
473
508
|
function continueGoogleStream({
|
|
@@ -890,6 +925,19 @@ function isEmptyObjectSchema(jsonSchema) {
|
|
|
890
925
|
// src/convert-to-google-generative-ai-messages.ts
|
|
891
926
|
var import_provider4 = require("@ai-sdk/provider");
|
|
892
927
|
var import_provider_utils6 = require("@ai-sdk/provider-utils");
|
|
928
|
+
|
|
929
|
+
// src/google-generative-ai-prompt.ts
|
|
930
|
+
var import_v46 = require("zod/v4");
|
|
931
|
+
var googleVideoMetadataSchema = import_v46.z.object({
|
|
932
|
+
/** Start offset as a duration in seconds, e.g. `'3.5s'`. */
|
|
933
|
+
startOffset: import_v46.z.string().optional(),
|
|
934
|
+
/** End offset as a duration in seconds, e.g. `'10s'`. */
|
|
935
|
+
endOffset: import_v46.z.string().optional(),
|
|
936
|
+
/** Frames per second in the range (0, 24]. Defaults to 1. */
|
|
937
|
+
fps: import_v46.z.number().gt(0).max(24).optional()
|
|
938
|
+
});
|
|
939
|
+
|
|
940
|
+
// src/convert-to-google-generative-ai-messages.ts
|
|
893
941
|
var SKIP_THOUGHT_SIGNATURE_VALIDATOR = "skip_thought_signature_validator";
|
|
894
942
|
function getGoogleProviderOptions(providerOptions, providerOptionsName) {
|
|
895
943
|
const namespaces = [
|
|
@@ -939,6 +987,31 @@ function convertUrlToolResultPart(url, mediaType, supportedFunctionResponseUrls)
|
|
|
939
987
|
}
|
|
940
988
|
} : void 0;
|
|
941
989
|
}
|
|
990
|
+
function serializeFunctionResponseContent(value) {
|
|
991
|
+
return containsNonJsonValue(value) ? (0, import_provider_utils6.secureJsonParse)((0, import_provider_utils6.stringifyWithBigIntAndCycles)(value)) : value;
|
|
992
|
+
}
|
|
993
|
+
function containsNonJsonValue(value, ancestors = /* @__PURE__ */ new Set()) {
|
|
994
|
+
if (typeof value === "bigint") {
|
|
995
|
+
return true;
|
|
996
|
+
}
|
|
997
|
+
if (typeof value !== "object" || value === null) {
|
|
998
|
+
return false;
|
|
999
|
+
}
|
|
1000
|
+
if (typeof value.toJSON === "function") {
|
|
1001
|
+
return true;
|
|
1002
|
+
}
|
|
1003
|
+
if (ancestors.has(value)) {
|
|
1004
|
+
return true;
|
|
1005
|
+
}
|
|
1006
|
+
ancestors.add(value);
|
|
1007
|
+
try {
|
|
1008
|
+
return Object.values(value).some(
|
|
1009
|
+
(item) => containsNonJsonValue(item, ancestors)
|
|
1010
|
+
);
|
|
1011
|
+
} finally {
|
|
1012
|
+
ancestors.delete(value);
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
942
1015
|
function appendToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true, supportedFunctionResponseUrls = {}) {
|
|
943
1016
|
const functionResponseParts = [];
|
|
944
1017
|
const responseTextParts = [];
|
|
@@ -968,12 +1041,12 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId, include
|
|
|
968
1041
|
if (functionResponsePart != null) {
|
|
969
1042
|
functionResponseParts.push(functionResponsePart);
|
|
970
1043
|
} else {
|
|
971
|
-
responseTextParts.push(
|
|
1044
|
+
responseTextParts.push((0, import_provider_utils6.stringifyWithBigIntAndCycles)(contentPart));
|
|
972
1045
|
}
|
|
973
1046
|
break;
|
|
974
1047
|
}
|
|
975
1048
|
default: {
|
|
976
|
-
responseTextParts.push(
|
|
1049
|
+
responseTextParts.push((0, import_provider_utils6.stringifyWithBigIntAndCycles)(contentPart));
|
|
977
1050
|
break;
|
|
978
1051
|
}
|
|
979
1052
|
}
|
|
@@ -1022,13 +1095,13 @@ function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId, i
|
|
|
1022
1095
|
break;
|
|
1023
1096
|
}
|
|
1024
1097
|
default:
|
|
1025
|
-
parts.push({ text:
|
|
1098
|
+
parts.push({ text: (0, import_provider_utils6.stringifyWithBigIntAndCycles)(contentPart) });
|
|
1026
1099
|
break;
|
|
1027
1100
|
}
|
|
1028
1101
|
}
|
|
1029
1102
|
}
|
|
1030
1103
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
1031
|
-
var _a2, _b, _c, _d, _e, _f, _g;
|
|
1104
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
1032
1105
|
const systemInstructionParts = [];
|
|
1033
1106
|
const contents = [];
|
|
1034
1107
|
let systemMessagesAllowed = true;
|
|
@@ -1068,17 +1141,24 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
1068
1141
|
}
|
|
1069
1142
|
case "file": {
|
|
1070
1143
|
const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
|
|
1144
|
+
const rawVideoMetadata = (_g = getGoogleProviderOptions(
|
|
1145
|
+
part.providerOptions,
|
|
1146
|
+
providerOptionsName
|
|
1147
|
+
)) == null ? void 0 : _g.videoMetadata;
|
|
1148
|
+
const videoMetadata = rawVideoMetadata == null ? void 0 : googleVideoMetadataSchema.parse(rawVideoMetadata);
|
|
1071
1149
|
parts.push(
|
|
1072
1150
|
part.data instanceof URL ? {
|
|
1073
1151
|
fileData: {
|
|
1074
1152
|
mimeType: mediaType,
|
|
1075
1153
|
fileUri: part.data.protocol === "gs:" && part.originalUrl != null ? part.originalUrl : part.data.toString()
|
|
1076
|
-
}
|
|
1154
|
+
},
|
|
1155
|
+
...videoMetadata != null ? { videoMetadata } : {}
|
|
1077
1156
|
} : {
|
|
1078
1157
|
inlineData: {
|
|
1079
1158
|
mimeType: mediaType,
|
|
1080
1159
|
data: (0, import_provider_utils6.convertToBase64)(part.data)
|
|
1081
|
-
}
|
|
1160
|
+
},
|
|
1161
|
+
...videoMetadata != null ? { videoMetadata } : {}
|
|
1082
1162
|
}
|
|
1083
1163
|
);
|
|
1084
1164
|
break;
|
|
@@ -1157,7 +1237,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
1157
1237
|
functionCall: {
|
|
1158
1238
|
...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
1159
1239
|
name: part.toolName,
|
|
1160
|
-
args: part.input
|
|
1240
|
+
args: parseToolCallInput(part.input)
|
|
1161
1241
|
},
|
|
1162
1242
|
thoughtSignature: effectiveThoughtSignature
|
|
1163
1243
|
};
|
|
@@ -1239,7 +1319,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
1239
1319
|
name: part.toolName,
|
|
1240
1320
|
response: {
|
|
1241
1321
|
name: part.toolName,
|
|
1242
|
-
content: output.type === "execution-denied" ? (
|
|
1322
|
+
content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool call execution denied." : serializeFunctionResponseContent(output.value)
|
|
1243
1323
|
}
|
|
1244
1324
|
}
|
|
1245
1325
|
});
|
|
@@ -1269,6 +1349,16 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
1269
1349
|
contents
|
|
1270
1350
|
};
|
|
1271
1351
|
}
|
|
1352
|
+
function parseToolCallInput(input) {
|
|
1353
|
+
if (typeof input !== "string") {
|
|
1354
|
+
return input;
|
|
1355
|
+
}
|
|
1356
|
+
try {
|
|
1357
|
+
return (0, import_provider_utils6.secureJsonParse)(input);
|
|
1358
|
+
} catch (e) {
|
|
1359
|
+
return input;
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1272
1362
|
|
|
1273
1363
|
// src/download-tool-result-files.ts
|
|
1274
1364
|
var import_provider_utils7 = require("@ai-sdk/provider-utils");
|
|
@@ -1343,23 +1433,23 @@ function getModelPath(modelId) {
|
|
|
1343
1433
|
|
|
1344
1434
|
// src/google-generative-ai-options.ts
|
|
1345
1435
|
var import_provider_utils8 = require("@ai-sdk/provider-utils");
|
|
1346
|
-
var
|
|
1436
|
+
var import_v47 = require("zod/v4");
|
|
1347
1437
|
var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
1348
1438
|
() => (0, import_provider_utils8.zodSchema)(
|
|
1349
|
-
|
|
1350
|
-
responseModalities:
|
|
1351
|
-
thinkingConfig:
|
|
1352
|
-
thinkingBudget:
|
|
1353
|
-
includeThoughts:
|
|
1439
|
+
import_v47.z.object({
|
|
1440
|
+
responseModalities: import_v47.z.array(import_v47.z.enum(["TEXT", "IMAGE"])).optional(),
|
|
1441
|
+
thinkingConfig: import_v47.z.object({
|
|
1442
|
+
thinkingBudget: import_v47.z.number().optional(),
|
|
1443
|
+
includeThoughts: import_v47.z.boolean().optional(),
|
|
1354
1444
|
// https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level
|
|
1355
|
-
thinkingLevel:
|
|
1445
|
+
thinkingLevel: import_v47.z.enum(["minimal", "low", "medium", "high"]).optional()
|
|
1356
1446
|
}).optional(),
|
|
1357
1447
|
/**
|
|
1358
1448
|
* Optional.
|
|
1359
1449
|
* The name of the cached content used as context to serve the prediction.
|
|
1360
1450
|
* Format: cachedContents/{cachedContent}
|
|
1361
1451
|
*/
|
|
1362
|
-
cachedContent:
|
|
1452
|
+
cachedContent: import_v47.z.string().optional(),
|
|
1363
1453
|
/**
|
|
1364
1454
|
* Optional. Enable structured output. Default is true.
|
|
1365
1455
|
*
|
|
@@ -1368,13 +1458,13 @@ var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
|
1368
1458
|
* Google Generative AI uses. You can use this to disable
|
|
1369
1459
|
* structured outputs if you need to.
|
|
1370
1460
|
*/
|
|
1371
|
-
structuredOutputs:
|
|
1461
|
+
structuredOutputs: import_v47.z.boolean().optional(),
|
|
1372
1462
|
/**
|
|
1373
1463
|
* Optional. A list of unique safety settings for blocking unsafe content.
|
|
1374
1464
|
*/
|
|
1375
|
-
safetySettings:
|
|
1376
|
-
|
|
1377
|
-
category:
|
|
1465
|
+
safetySettings: import_v47.z.array(
|
|
1466
|
+
import_v47.z.object({
|
|
1467
|
+
category: import_v47.z.enum([
|
|
1378
1468
|
"HARM_CATEGORY_UNSPECIFIED",
|
|
1379
1469
|
"HARM_CATEGORY_HATE_SPEECH",
|
|
1380
1470
|
"HARM_CATEGORY_DANGEROUS_CONTENT",
|
|
@@ -1382,7 +1472,7 @@ var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
|
1382
1472
|
"HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
|
1383
1473
|
"HARM_CATEGORY_CIVIC_INTEGRITY"
|
|
1384
1474
|
]),
|
|
1385
|
-
threshold:
|
|
1475
|
+
threshold: import_v47.z.enum([
|
|
1386
1476
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
|
1387
1477
|
"BLOCK_LOW_AND_ABOVE",
|
|
1388
1478
|
"BLOCK_MEDIUM_AND_ABOVE",
|
|
@@ -1392,7 +1482,7 @@ var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
|
1392
1482
|
])
|
|
1393
1483
|
})
|
|
1394
1484
|
).optional(),
|
|
1395
|
-
threshold:
|
|
1485
|
+
threshold: import_v47.z.enum([
|
|
1396
1486
|
"HARM_BLOCK_THRESHOLD_UNSPECIFIED",
|
|
1397
1487
|
"BLOCK_LOW_AND_ABOVE",
|
|
1398
1488
|
"BLOCK_MEDIUM_AND_ABOVE",
|
|
@@ -1405,19 +1495,19 @@ var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
|
1405
1495
|
*
|
|
1406
1496
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
|
|
1407
1497
|
*/
|
|
1408
|
-
audioTimestamp:
|
|
1498
|
+
audioTimestamp: import_v47.z.boolean().optional(),
|
|
1409
1499
|
/**
|
|
1410
1500
|
* Optional. Defines labels used in billing reports. Available on Vertex AI only.
|
|
1411
1501
|
*
|
|
1412
1502
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
|
|
1413
1503
|
*/
|
|
1414
|
-
labels:
|
|
1504
|
+
labels: import_v47.z.record(import_v47.z.string(), import_v47.z.string()).optional(),
|
|
1415
1505
|
/**
|
|
1416
1506
|
* Optional. If specified, the media resolution specified will be used.
|
|
1417
1507
|
*
|
|
1418
1508
|
* https://ai.google.dev/api/generate-content#MediaResolution
|
|
1419
1509
|
*/
|
|
1420
|
-
mediaResolution:
|
|
1510
|
+
mediaResolution: import_v47.z.enum([
|
|
1421
1511
|
"MEDIA_RESOLUTION_UNSPECIFIED",
|
|
1422
1512
|
"MEDIA_RESOLUTION_LOW",
|
|
1423
1513
|
"MEDIA_RESOLUTION_MEDIUM",
|
|
@@ -1428,8 +1518,8 @@ var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
|
1428
1518
|
*
|
|
1429
1519
|
* https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios
|
|
1430
1520
|
*/
|
|
1431
|
-
imageConfig:
|
|
1432
|
-
aspectRatio:
|
|
1521
|
+
imageConfig: import_v47.z.object({
|
|
1522
|
+
aspectRatio: import_v47.z.enum([
|
|
1433
1523
|
"1:1",
|
|
1434
1524
|
"2:3",
|
|
1435
1525
|
"3:2",
|
|
@@ -1445,12 +1535,12 @@ var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
|
1445
1535
|
"1:4",
|
|
1446
1536
|
"4:1"
|
|
1447
1537
|
]).optional(),
|
|
1448
|
-
imageSize:
|
|
1538
|
+
imageSize: import_v47.z.enum(["1K", "2K", "4K", "512"]).optional(),
|
|
1449
1539
|
/**
|
|
1450
1540
|
* Optional. Controls the generation of people in images.
|
|
1451
1541
|
* Vertex AI only.
|
|
1452
1542
|
*/
|
|
1453
|
-
personGeneration:
|
|
1543
|
+
personGeneration: import_v47.z.enum([
|
|
1454
1544
|
"PERSON_GENERATION_UNSPECIFIED",
|
|
1455
1545
|
"ALLOW_ALL",
|
|
1456
1546
|
"ALLOW_ADULT",
|
|
@@ -1464,7 +1554,7 @@ var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
|
1464
1554
|
*
|
|
1465
1555
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
|
|
1466
1556
|
*/
|
|
1467
|
-
prominentPeople:
|
|
1557
|
+
prominentPeople: import_v47.z.enum([
|
|
1468
1558
|
"PROMINENT_PEOPLE_UNSPECIFIED",
|
|
1469
1559
|
"ALLOW_PROMINENT_PEOPLE",
|
|
1470
1560
|
"BLOCK_PROMINENT_PEOPLE"
|
|
@@ -1473,9 +1563,9 @@ var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
|
1473
1563
|
* Optional. The image output format for generated images.
|
|
1474
1564
|
* Vertex AI only.
|
|
1475
1565
|
*/
|
|
1476
|
-
imageOutputOptions:
|
|
1477
|
-
mimeType:
|
|
1478
|
-
compressionQuality:
|
|
1566
|
+
imageOutputOptions: import_v47.z.object({
|
|
1567
|
+
mimeType: import_v47.z.enum(["image/jpeg", "image/png"]).optional(),
|
|
1568
|
+
compressionQuality: import_v47.z.number().optional()
|
|
1479
1569
|
}).optional()
|
|
1480
1570
|
}).optional(),
|
|
1481
1571
|
/**
|
|
@@ -1484,10 +1574,10 @@ var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
|
1484
1574
|
*
|
|
1485
1575
|
* https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
1486
1576
|
*/
|
|
1487
|
-
retrievalConfig:
|
|
1488
|
-
latLng:
|
|
1489
|
-
latitude:
|
|
1490
|
-
longitude:
|
|
1577
|
+
retrievalConfig: import_v47.z.object({
|
|
1578
|
+
latLng: import_v47.z.object({
|
|
1579
|
+
latitude: import_v47.z.number(),
|
|
1580
|
+
longitude: import_v47.z.number()
|
|
1491
1581
|
}).optional()
|
|
1492
1582
|
}).optional(),
|
|
1493
1583
|
/**
|
|
@@ -1500,12 +1590,12 @@ var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
|
1500
1590
|
*
|
|
1501
1591
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc
|
|
1502
1592
|
*/
|
|
1503
|
-
streamFunctionCallArguments:
|
|
1593
|
+
streamFunctionCallArguments: import_v47.z.boolean().optional(),
|
|
1504
1594
|
/**
|
|
1505
1595
|
* Optional. The service tier to use for the request. Sent as the
|
|
1506
1596
|
* `serviceTier` body field. Gemini API only.
|
|
1507
1597
|
*/
|
|
1508
|
-
serviceTier:
|
|
1598
|
+
serviceTier: import_v47.z.enum(["standard", "flex", "priority"]).optional(),
|
|
1509
1599
|
/**
|
|
1510
1600
|
* Optional. Resumes a response that stopped with `MAX_TOKENS` because it
|
|
1511
1601
|
* used up its `maxOutputTokens` budget (Gemini 4 long decode). Pass the
|
|
@@ -1515,7 +1605,7 @@ var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
|
1515
1605
|
* per-request cap while budget remains (`CONTINUATION`) are continued
|
|
1516
1606
|
* automatically. Sent as the `continuationToken` body field.
|
|
1517
1607
|
*/
|
|
1518
|
-
continuationToken:
|
|
1608
|
+
continuationToken: import_v47.z.string().optional(),
|
|
1519
1609
|
/**
|
|
1520
1610
|
* Optional. Vertex AI only. Sent as the
|
|
1521
1611
|
* `X-Vertex-AI-LLM-Shared-Request-Type` request header to select a
|
|
@@ -1526,7 +1616,7 @@ var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
|
1526
1616
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/priority-paygo
|
|
1527
1617
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/flex-paygo
|
|
1528
1618
|
*/
|
|
1529
|
-
sharedRequestType:
|
|
1619
|
+
sharedRequestType: import_v47.z.enum(["priority", "flex", "standard"]).optional(),
|
|
1530
1620
|
/**
|
|
1531
1621
|
* Optional. Vertex AI only. Sent as the `X-Vertex-AI-LLM-Request-Type`
|
|
1532
1622
|
* request header. Set to `'shared'` together with `sharedRequestType`
|
|
@@ -1534,7 +1624,7 @@ var googleLanguageModelOptions = (0, import_provider_utils8.lazySchema)(
|
|
|
1534
1624
|
*
|
|
1535
1625
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/priority-paygo
|
|
1536
1626
|
*/
|
|
1537
|
-
requestType:
|
|
1627
|
+
requestType: import_v47.z.enum(["shared"]).optional()
|
|
1538
1628
|
})
|
|
1539
1629
|
)
|
|
1540
1630
|
);
|
|
@@ -2563,10 +2653,11 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2563
2653
|
options.headers,
|
|
2564
2654
|
extraHeaders
|
|
2565
2655
|
);
|
|
2656
|
+
const url = `${this.config.baseURL}/${getModelPath(
|
|
2657
|
+
this.modelId
|
|
2658
|
+
)}:streamGenerateContent?alt=sse`;
|
|
2566
2659
|
const streamGenerateContent = (body) => (0, import_provider_utils9.postJsonToApi)({
|
|
2567
|
-
url
|
|
2568
|
-
this.modelId
|
|
2569
|
-
)}:streamGenerateContent?alt=sse`,
|
|
2660
|
+
url,
|
|
2570
2661
|
headers,
|
|
2571
2662
|
body,
|
|
2572
2663
|
failedResponseHandler: googleFailedResponseHandler,
|
|
@@ -2656,7 +2747,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2656
2747
|
controller.enqueue({ type: "stream-start", warnings });
|
|
2657
2748
|
},
|
|
2658
2749
|
transform(chunk, controller) {
|
|
2659
|
-
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
2750
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
2660
2751
|
if (options.includeRawChunks) {
|
|
2661
2752
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
2662
2753
|
}
|
|
@@ -2665,6 +2756,23 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2665
2756
|
return;
|
|
2666
2757
|
}
|
|
2667
2758
|
const value = chunk.value;
|
|
2759
|
+
if (value.error != null) {
|
|
2760
|
+
finishReason = { unified: "error", raw: void 0 };
|
|
2761
|
+
const error = value.error;
|
|
2762
|
+
controller.enqueue({
|
|
2763
|
+
type: "error",
|
|
2764
|
+
error: new import_provider6.APICallError({
|
|
2765
|
+
message: error.message,
|
|
2766
|
+
url,
|
|
2767
|
+
requestBodyValues: args,
|
|
2768
|
+
statusCode: (_a2 = error.code) != null ? _a2 : mapGoogleErrorStatusToHttpStatusCode(error.status),
|
|
2769
|
+
responseHeaders,
|
|
2770
|
+
responseBody: JSON.stringify({ error }),
|
|
2771
|
+
data: error
|
|
2772
|
+
})
|
|
2773
|
+
});
|
|
2774
|
+
return;
|
|
2775
|
+
}
|
|
2668
2776
|
if (!hasEmittedResponseMetadata && value.responseId != null) {
|
|
2669
2777
|
hasEmittedResponseMetadata = true;
|
|
2670
2778
|
controller.enqueue({
|
|
@@ -2686,7 +2794,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2686
2794
|
};
|
|
2687
2795
|
}
|
|
2688
2796
|
}
|
|
2689
|
-
const candidate = (
|
|
2797
|
+
const candidate = (_b = value.candidates) == null ? void 0 : _b[0];
|
|
2690
2798
|
if (candidate != null) {
|
|
2691
2799
|
if (candidate.groundingMetadata != null) {
|
|
2692
2800
|
lastGroundingMetadata = candidate.groundingMetadata;
|
|
@@ -2721,9 +2829,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2721
2829
|
}
|
|
2722
2830
|
}
|
|
2723
2831
|
if (content != null) {
|
|
2724
|
-
const parts = (
|
|
2832
|
+
const parts = (_c = content.parts) != null ? _c : [];
|
|
2725
2833
|
for (const part of parts) {
|
|
2726
|
-
if ("executableCode" in part && ((
|
|
2834
|
+
if ("executableCode" in part && ((_d = part.executableCode) == null ? void 0 : _d.code)) {
|
|
2727
2835
|
const toolCallId = generateId3();
|
|
2728
2836
|
lastCodeExecutionToolCallId = toolCallId;
|
|
2729
2837
|
controller.enqueue({
|
|
@@ -2742,7 +2850,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2742
2850
|
toolName: "code_execution",
|
|
2743
2851
|
result: {
|
|
2744
2852
|
outcome: part.codeExecutionResult.outcome,
|
|
2745
|
-
output: (
|
|
2853
|
+
output: (_e = part.codeExecutionResult.output) != null ? _e : ""
|
|
2746
2854
|
}
|
|
2747
2855
|
});
|
|
2748
2856
|
}
|
|
@@ -2836,7 +2944,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2836
2944
|
providerMetadata: fileMeta
|
|
2837
2945
|
});
|
|
2838
2946
|
} else if ("toolCall" in part && part.toolCall) {
|
|
2839
|
-
const toolCallId = (
|
|
2947
|
+
const toolCallId = (_f = part.toolCall.id) != null ? _f : generateId3();
|
|
2840
2948
|
lastServerToolCallId = toolCallId;
|
|
2841
2949
|
const serverMeta = {
|
|
2842
2950
|
[providerOptionsName]: {
|
|
@@ -2849,13 +2957,13 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2849
2957
|
type: "tool-call",
|
|
2850
2958
|
toolCallId,
|
|
2851
2959
|
toolName: `server:${part.toolCall.toolType}`,
|
|
2852
|
-
input: JSON.stringify((
|
|
2960
|
+
input: JSON.stringify((_g = part.toolCall.args) != null ? _g : {}),
|
|
2853
2961
|
providerExecuted: true,
|
|
2854
2962
|
dynamic: true,
|
|
2855
2963
|
providerMetadata: serverMeta
|
|
2856
2964
|
});
|
|
2857
2965
|
} else if ("toolResponse" in part && part.toolResponse) {
|
|
2858
|
-
const responseToolCallId = (
|
|
2966
|
+
const responseToolCallId = (_h = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _h : generateId3();
|
|
2859
2967
|
const serverMeta = {
|
|
2860
2968
|
[providerOptionsName]: {
|
|
2861
2969
|
...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
|
|
@@ -2867,7 +2975,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2867
2975
|
type: "tool-result",
|
|
2868
2976
|
toolCallId: responseToolCallId,
|
|
2869
2977
|
toolName: `server:${part.toolResponse.toolType}`,
|
|
2870
|
-
result: (
|
|
2978
|
+
result: (_i = part.toolResponse.response) != null ? _i : {},
|
|
2871
2979
|
providerMetadata: serverMeta
|
|
2872
2980
|
});
|
|
2873
2981
|
lastServerToolCallId = void 0;
|
|
@@ -2886,7 +2994,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2886
2994
|
const isNoArgsCompleteCall = part.functionCall.name != null && part.functionCall.args == null && part.functionCall.partialArgs == null && part.functionCall.willContinue !== true;
|
|
2887
2995
|
if (isStreamingChunk) {
|
|
2888
2996
|
if (part.functionCall.name != null) {
|
|
2889
|
-
const toolCallId = (
|
|
2997
|
+
const toolCallId = (_j = part.functionCall.id) != null ? _j : generateId3();
|
|
2890
2998
|
const accumulator = new GoogleJSONAccumulator();
|
|
2891
2999
|
activeStreamingToolCalls.push({
|
|
2892
3000
|
toolCallId,
|
|
@@ -2934,9 +3042,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2934
3042
|
} else if (isTerminalChunk && activeStreamingToolCalls.length > 0) {
|
|
2935
3043
|
finishActiveStreamingToolCall(controller);
|
|
2936
3044
|
} else if (isCompleteCall) {
|
|
2937
|
-
const toolCallId = (
|
|
3045
|
+
const toolCallId = (_k = part.functionCall.id) != null ? _k : generateId3();
|
|
2938
3046
|
const toolName = part.functionCall.name;
|
|
2939
|
-
const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((
|
|
3047
|
+
const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_l = part.functionCall.args) != null ? _l : {});
|
|
2940
3048
|
controller.enqueue({
|
|
2941
3049
|
type: "tool-input-start",
|
|
2942
3050
|
id: toolCallId,
|
|
@@ -2963,7 +3071,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
2963
3071
|
});
|
|
2964
3072
|
hasToolCalls = true;
|
|
2965
3073
|
} else if (isNoArgsCompleteCall) {
|
|
2966
|
-
const toolCallId = (
|
|
3074
|
+
const toolCallId = (_m = part.functionCall.id) != null ? _m : generateId3();
|
|
2967
3075
|
const toolName = part.functionCall.name;
|
|
2968
3076
|
controller.enqueue({
|
|
2969
3077
|
type: "tool-input-start",
|
|
@@ -3151,205 +3259,206 @@ function extractSources({
|
|
|
3151
3259
|
}
|
|
3152
3260
|
return sources.length > 0 ? sources : void 0;
|
|
3153
3261
|
}
|
|
3154
|
-
var getGroundingMetadataSchema = () =>
|
|
3155
|
-
webSearchQueries:
|
|
3156
|
-
imageSearchQueries:
|
|
3157
|
-
retrievalQueries:
|
|
3158
|
-
searchEntryPoint:
|
|
3159
|
-
groundingChunks:
|
|
3160
|
-
|
|
3161
|
-
web:
|
|
3162
|
-
image:
|
|
3163
|
-
sourceUri:
|
|
3164
|
-
imageUri:
|
|
3165
|
-
title:
|
|
3166
|
-
domain:
|
|
3262
|
+
var getGroundingMetadataSchema = () => import_v48.z.object({
|
|
3263
|
+
webSearchQueries: import_v48.z.array(import_v48.z.string()).nullish(),
|
|
3264
|
+
imageSearchQueries: import_v48.z.array(import_v48.z.string()).nullish(),
|
|
3265
|
+
retrievalQueries: import_v48.z.array(import_v48.z.string()).nullish(),
|
|
3266
|
+
searchEntryPoint: import_v48.z.object({ renderedContent: import_v48.z.string() }).nullish(),
|
|
3267
|
+
groundingChunks: import_v48.z.array(
|
|
3268
|
+
import_v48.z.object({
|
|
3269
|
+
web: import_v48.z.object({ uri: import_v48.z.string(), title: import_v48.z.string().nullish() }).nullish(),
|
|
3270
|
+
image: import_v48.z.object({
|
|
3271
|
+
sourceUri: import_v48.z.string(),
|
|
3272
|
+
imageUri: import_v48.z.string(),
|
|
3273
|
+
title: import_v48.z.string().nullish(),
|
|
3274
|
+
domain: import_v48.z.string().nullish()
|
|
3167
3275
|
}).nullish(),
|
|
3168
|
-
retrievedContext:
|
|
3169
|
-
uri:
|
|
3170
|
-
title:
|
|
3171
|
-
text:
|
|
3172
|
-
fileSearchStore:
|
|
3173
|
-
customMetadata:
|
|
3174
|
-
|
|
3175
|
-
key:
|
|
3176
|
-
stringValue:
|
|
3177
|
-
numericValue:
|
|
3178
|
-
stringListValue:
|
|
3276
|
+
retrievedContext: import_v48.z.object({
|
|
3277
|
+
uri: import_v48.z.string().nullish(),
|
|
3278
|
+
title: import_v48.z.string().nullish(),
|
|
3279
|
+
text: import_v48.z.string().nullish(),
|
|
3280
|
+
fileSearchStore: import_v48.z.string().nullish(),
|
|
3281
|
+
customMetadata: import_v48.z.array(
|
|
3282
|
+
import_v48.z.object({
|
|
3283
|
+
key: import_v48.z.string(),
|
|
3284
|
+
stringValue: import_v48.z.string().nullish(),
|
|
3285
|
+
numericValue: import_v48.z.number().nullish(),
|
|
3286
|
+
stringListValue: import_v48.z.object({ values: import_v48.z.array(import_v48.z.string()).nullish() }).nullish()
|
|
3179
3287
|
})
|
|
3180
3288
|
).nullish()
|
|
3181
3289
|
}).nullish(),
|
|
3182
|
-
maps:
|
|
3183
|
-
uri:
|
|
3184
|
-
title:
|
|
3185
|
-
text:
|
|
3186
|
-
placeId:
|
|
3290
|
+
maps: import_v48.z.object({
|
|
3291
|
+
uri: import_v48.z.string().nullish(),
|
|
3292
|
+
title: import_v48.z.string().nullish(),
|
|
3293
|
+
text: import_v48.z.string().nullish(),
|
|
3294
|
+
placeId: import_v48.z.string().nullish()
|
|
3187
3295
|
}).nullish()
|
|
3188
3296
|
})
|
|
3189
3297
|
).nullish(),
|
|
3190
|
-
groundingSupports:
|
|
3191
|
-
|
|
3192
|
-
segment:
|
|
3193
|
-
startIndex:
|
|
3194
|
-
endIndex:
|
|
3195
|
-
text:
|
|
3298
|
+
groundingSupports: import_v48.z.array(
|
|
3299
|
+
import_v48.z.object({
|
|
3300
|
+
segment: import_v48.z.object({
|
|
3301
|
+
startIndex: import_v48.z.number().nullish(),
|
|
3302
|
+
endIndex: import_v48.z.number().nullish(),
|
|
3303
|
+
text: import_v48.z.string().nullish()
|
|
3196
3304
|
}).nullish(),
|
|
3197
|
-
segment_text:
|
|
3198
|
-
groundingChunkIndices:
|
|
3199
|
-
supportChunkIndices:
|
|
3200
|
-
confidenceScores:
|
|
3201
|
-
confidenceScore:
|
|
3305
|
+
segment_text: import_v48.z.string().nullish(),
|
|
3306
|
+
groundingChunkIndices: import_v48.z.array(import_v48.z.number()).nullish(),
|
|
3307
|
+
supportChunkIndices: import_v48.z.array(import_v48.z.number()).nullish(),
|
|
3308
|
+
confidenceScores: import_v48.z.array(import_v48.z.number()).nullish(),
|
|
3309
|
+
confidenceScore: import_v48.z.array(import_v48.z.number()).nullish()
|
|
3202
3310
|
})
|
|
3203
3311
|
).nullish(),
|
|
3204
|
-
retrievalMetadata:
|
|
3205
|
-
|
|
3206
|
-
webDynamicRetrievalScore:
|
|
3312
|
+
retrievalMetadata: import_v48.z.union([
|
|
3313
|
+
import_v48.z.object({
|
|
3314
|
+
webDynamicRetrievalScore: import_v48.z.number()
|
|
3207
3315
|
}),
|
|
3208
|
-
|
|
3316
|
+
import_v48.z.object({})
|
|
3209
3317
|
]).nullish()
|
|
3210
3318
|
});
|
|
3211
|
-
var partialArgSchema = () =>
|
|
3212
|
-
jsonPath:
|
|
3213
|
-
stringValue:
|
|
3214
|
-
numberValue:
|
|
3215
|
-
boolValue:
|
|
3216
|
-
nullValue:
|
|
3217
|
-
willContinue:
|
|
3319
|
+
var partialArgSchema = () => import_v48.z.object({
|
|
3320
|
+
jsonPath: import_v48.z.string(),
|
|
3321
|
+
stringValue: import_v48.z.string().nullish(),
|
|
3322
|
+
numberValue: import_v48.z.number().nullish(),
|
|
3323
|
+
boolValue: import_v48.z.boolean().nullish(),
|
|
3324
|
+
nullValue: import_v48.z.unknown().nullish(),
|
|
3325
|
+
willContinue: import_v48.z.boolean().nullish()
|
|
3218
3326
|
});
|
|
3219
|
-
var getContentSchema = () =>
|
|
3220
|
-
parts:
|
|
3221
|
-
|
|
3327
|
+
var getContentSchema = () => import_v48.z.object({
|
|
3328
|
+
parts: import_v48.z.array(
|
|
3329
|
+
import_v48.z.union([
|
|
3222
3330
|
// note: order matters since text can be fully empty
|
|
3223
|
-
|
|
3224
|
-
functionCall:
|
|
3225
|
-
id:
|
|
3226
|
-
name:
|
|
3227
|
-
args:
|
|
3228
|
-
partialArgs:
|
|
3229
|
-
willContinue:
|
|
3331
|
+
import_v48.z.object({
|
|
3332
|
+
functionCall: import_v48.z.object({
|
|
3333
|
+
id: import_v48.z.string().nullish(),
|
|
3334
|
+
name: import_v48.z.string().nullish(),
|
|
3335
|
+
args: import_v48.z.unknown().nullish(),
|
|
3336
|
+
partialArgs: import_v48.z.array(partialArgSchema()).nullish(),
|
|
3337
|
+
willContinue: import_v48.z.boolean().nullish()
|
|
3230
3338
|
}),
|
|
3231
|
-
thoughtSignature:
|
|
3339
|
+
thoughtSignature: import_v48.z.string().nullish()
|
|
3232
3340
|
}),
|
|
3233
|
-
|
|
3234
|
-
inlineData:
|
|
3235
|
-
mimeType:
|
|
3236
|
-
data:
|
|
3341
|
+
import_v48.z.object({
|
|
3342
|
+
inlineData: import_v48.z.object({
|
|
3343
|
+
mimeType: import_v48.z.string(),
|
|
3344
|
+
data: import_v48.z.string()
|
|
3237
3345
|
}),
|
|
3238
|
-
thought:
|
|
3239
|
-
thoughtSignature:
|
|
3346
|
+
thought: import_v48.z.boolean().nullish(),
|
|
3347
|
+
thoughtSignature: import_v48.z.string().nullish()
|
|
3240
3348
|
}),
|
|
3241
|
-
|
|
3242
|
-
toolCall:
|
|
3243
|
-
toolType:
|
|
3244
|
-
args:
|
|
3245
|
-
id:
|
|
3349
|
+
import_v48.z.object({
|
|
3350
|
+
toolCall: import_v48.z.object({
|
|
3351
|
+
toolType: import_v48.z.string(),
|
|
3352
|
+
args: import_v48.z.unknown().nullish(),
|
|
3353
|
+
id: import_v48.z.string()
|
|
3246
3354
|
}),
|
|
3247
|
-
thoughtSignature:
|
|
3355
|
+
thoughtSignature: import_v48.z.string().nullish()
|
|
3248
3356
|
}),
|
|
3249
|
-
|
|
3250
|
-
toolResponse:
|
|
3251
|
-
toolType:
|
|
3252
|
-
response:
|
|
3253
|
-
id:
|
|
3357
|
+
import_v48.z.object({
|
|
3358
|
+
toolResponse: import_v48.z.object({
|
|
3359
|
+
toolType: import_v48.z.string(),
|
|
3360
|
+
response: import_v48.z.unknown().nullish(),
|
|
3361
|
+
id: import_v48.z.string()
|
|
3254
3362
|
}),
|
|
3255
|
-
thoughtSignature:
|
|
3363
|
+
thoughtSignature: import_v48.z.string().nullish()
|
|
3256
3364
|
}),
|
|
3257
|
-
|
|
3258
|
-
executableCode:
|
|
3259
|
-
language:
|
|
3260
|
-
code:
|
|
3365
|
+
import_v48.z.object({
|
|
3366
|
+
executableCode: import_v48.z.object({
|
|
3367
|
+
language: import_v48.z.string(),
|
|
3368
|
+
code: import_v48.z.string()
|
|
3261
3369
|
}).nullish(),
|
|
3262
|
-
codeExecutionResult:
|
|
3263
|
-
outcome:
|
|
3264
|
-
output:
|
|
3370
|
+
codeExecutionResult: import_v48.z.object({
|
|
3371
|
+
outcome: import_v48.z.string(),
|
|
3372
|
+
output: import_v48.z.string().nullish()
|
|
3265
3373
|
}).nullish(),
|
|
3266
|
-
text:
|
|
3267
|
-
thought:
|
|
3268
|
-
thoughtSignature:
|
|
3374
|
+
text: import_v48.z.string().nullish(),
|
|
3375
|
+
thought: import_v48.z.boolean().nullish(),
|
|
3376
|
+
thoughtSignature: import_v48.z.string().nullish()
|
|
3269
3377
|
})
|
|
3270
3378
|
])
|
|
3271
3379
|
).nullish()
|
|
3272
3380
|
});
|
|
3273
|
-
var getSafetyRatingSchema = () =>
|
|
3274
|
-
category:
|
|
3275
|
-
probability:
|
|
3276
|
-
probabilityScore:
|
|
3277
|
-
severity:
|
|
3278
|
-
severityScore:
|
|
3279
|
-
blocked:
|
|
3381
|
+
var getSafetyRatingSchema = () => import_v48.z.object({
|
|
3382
|
+
category: import_v48.z.string().nullish(),
|
|
3383
|
+
probability: import_v48.z.string().nullish(),
|
|
3384
|
+
probabilityScore: import_v48.z.number().nullish(),
|
|
3385
|
+
severity: import_v48.z.string().nullish(),
|
|
3386
|
+
severityScore: import_v48.z.number().nullish(),
|
|
3387
|
+
blocked: import_v48.z.boolean().nullish()
|
|
3280
3388
|
});
|
|
3281
|
-
var tokenDetailsSchema = () =>
|
|
3282
|
-
|
|
3283
|
-
modality:
|
|
3284
|
-
tokenCount:
|
|
3285
|
-
}).catchall(
|
|
3389
|
+
var tokenDetailsSchema = () => import_v48.z.array(
|
|
3390
|
+
import_v48.z.object({
|
|
3391
|
+
modality: import_v48.z.string(),
|
|
3392
|
+
tokenCount: import_v48.z.number()
|
|
3393
|
+
}).catchall(import_v48.z.json())
|
|
3286
3394
|
).nullish();
|
|
3287
|
-
var usageSchema = () =>
|
|
3288
|
-
cachedContentTokenCount:
|
|
3289
|
-
thoughtsTokenCount:
|
|
3290
|
-
promptTokenCount:
|
|
3291
|
-
candidatesTokenCount:
|
|
3292
|
-
toolUsePromptTokenCount:
|
|
3293
|
-
totalTokenCount:
|
|
3395
|
+
var usageSchema = () => import_v48.z.object({
|
|
3396
|
+
cachedContentTokenCount: import_v48.z.number().nullish(),
|
|
3397
|
+
thoughtsTokenCount: import_v48.z.number().nullish(),
|
|
3398
|
+
promptTokenCount: import_v48.z.number().nullish(),
|
|
3399
|
+
candidatesTokenCount: import_v48.z.number().nullish(),
|
|
3400
|
+
toolUsePromptTokenCount: import_v48.z.number().nullish(),
|
|
3401
|
+
totalTokenCount: import_v48.z.number().nullish(),
|
|
3294
3402
|
// https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType
|
|
3295
|
-
trafficType:
|
|
3296
|
-
serviceTier:
|
|
3403
|
+
trafficType: import_v48.z.string().nullish(),
|
|
3404
|
+
serviceTier: import_v48.z.string().nullish(),
|
|
3297
3405
|
// https://ai.google.dev/api/generate-content#Modality
|
|
3298
3406
|
promptTokensDetails: tokenDetailsSchema(),
|
|
3299
3407
|
cacheTokensDetails: tokenDetailsSchema(),
|
|
3300
3408
|
candidatesTokensDetails: tokenDetailsSchema(),
|
|
3301
3409
|
toolUsePromptTokensDetails: tokenDetailsSchema()
|
|
3302
|
-
}).catchall(
|
|
3303
|
-
var getUrlContextMetadataSchema = () =>
|
|
3304
|
-
urlMetadata:
|
|
3305
|
-
|
|
3306
|
-
retrievedUrl:
|
|
3307
|
-
urlRetrievalStatus:
|
|
3410
|
+
}).catchall(import_v48.z.json());
|
|
3411
|
+
var getUrlContextMetadataSchema = () => import_v48.z.object({
|
|
3412
|
+
urlMetadata: import_v48.z.array(
|
|
3413
|
+
import_v48.z.object({
|
|
3414
|
+
retrievedUrl: import_v48.z.string(),
|
|
3415
|
+
urlRetrievalStatus: import_v48.z.string()
|
|
3308
3416
|
})
|
|
3309
3417
|
).nullish()
|
|
3310
3418
|
});
|
|
3311
3419
|
var responseSchema = (0, import_provider_utils9.lazySchema)(
|
|
3312
3420
|
() => (0, import_provider_utils9.zodSchema)(
|
|
3313
|
-
|
|
3314
|
-
responseId:
|
|
3315
|
-
candidates:
|
|
3316
|
-
|
|
3317
|
-
content: getContentSchema().nullish().or(
|
|
3318
|
-
finishReason:
|
|
3319
|
-
finishMessage:
|
|
3320
|
-
continuationToken:
|
|
3321
|
-
safetyRatings:
|
|
3421
|
+
import_v48.z.object({
|
|
3422
|
+
responseId: import_v48.z.string().nullish(),
|
|
3423
|
+
candidates: import_v48.z.array(
|
|
3424
|
+
import_v48.z.object({
|
|
3425
|
+
content: getContentSchema().nullish().or(import_v48.z.object({}).strict()),
|
|
3426
|
+
finishReason: import_v48.z.string().nullish(),
|
|
3427
|
+
finishMessage: import_v48.z.string().nullish(),
|
|
3428
|
+
continuationToken: import_v48.z.string().nullish(),
|
|
3429
|
+
safetyRatings: import_v48.z.array(getSafetyRatingSchema()).nullish(),
|
|
3322
3430
|
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
|
3323
3431
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
3324
3432
|
})
|
|
3325
3433
|
).nullish(),
|
|
3326
3434
|
usageMetadata: usageSchema().nullish(),
|
|
3327
|
-
promptFeedback:
|
|
3328
|
-
blockReason:
|
|
3329
|
-
safetyRatings:
|
|
3435
|
+
promptFeedback: import_v48.z.object({
|
|
3436
|
+
blockReason: import_v48.z.string().nullish(),
|
|
3437
|
+
safetyRatings: import_v48.z.array(getSafetyRatingSchema()).nullish()
|
|
3330
3438
|
}).nullish()
|
|
3331
3439
|
})
|
|
3332
3440
|
)
|
|
3333
3441
|
);
|
|
3334
3442
|
var chunkSchema = (0, import_provider_utils9.lazySchema)(
|
|
3335
3443
|
() => (0, import_provider_utils9.zodSchema)(
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3444
|
+
import_v48.z.object({
|
|
3445
|
+
error: getGoogleErrorSchema().nullish(),
|
|
3446
|
+
responseId: import_v48.z.string().nullish(),
|
|
3447
|
+
candidates: import_v48.z.array(
|
|
3448
|
+
import_v48.z.object({
|
|
3340
3449
|
content: getContentSchema().nullish(),
|
|
3341
|
-
finishReason:
|
|
3342
|
-
finishMessage:
|
|
3343
|
-
continuationToken:
|
|
3344
|
-
safetyRatings:
|
|
3450
|
+
finishReason: import_v48.z.string().nullish(),
|
|
3451
|
+
finishMessage: import_v48.z.string().nullish(),
|
|
3452
|
+
continuationToken: import_v48.z.string().nullish(),
|
|
3453
|
+
safetyRatings: import_v48.z.array(getSafetyRatingSchema()).nullish(),
|
|
3345
3454
|
groundingMetadata: getGroundingMetadataSchema().nullish(),
|
|
3346
3455
|
urlContextMetadata: getUrlContextMetadataSchema().nullish()
|
|
3347
3456
|
})
|
|
3348
3457
|
).nullish(),
|
|
3349
3458
|
usageMetadata: usageSchema().nullish(),
|
|
3350
|
-
promptFeedback:
|
|
3351
|
-
blockReason:
|
|
3352
|
-
safetyRatings:
|
|
3459
|
+
promptFeedback: import_v48.z.object({
|
|
3460
|
+
blockReason: import_v48.z.string().nullish(),
|
|
3461
|
+
safetyRatings: import_v48.z.array(getSafetyRatingSchema()).nullish()
|
|
3353
3462
|
}).nullish()
|
|
3354
3463
|
})
|
|
3355
3464
|
)
|
|
@@ -3360,43 +3469,43 @@ function isConfirmedPromptBlockReason(blockReason) {
|
|
|
3360
3469
|
|
|
3361
3470
|
// src/tool/code-execution.ts
|
|
3362
3471
|
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
3363
|
-
var
|
|
3472
|
+
var import_v49 = require("zod/v4");
|
|
3364
3473
|
var codeExecution = (0, import_provider_utils10.createProviderToolFactoryWithOutputSchema)({
|
|
3365
3474
|
id: "google.code_execution",
|
|
3366
|
-
inputSchema:
|
|
3367
|
-
language:
|
|
3368
|
-
code:
|
|
3475
|
+
inputSchema: import_v49.z.object({
|
|
3476
|
+
language: import_v49.z.string().describe("The programming language of the code."),
|
|
3477
|
+
code: import_v49.z.string().describe("The code to be executed.")
|
|
3369
3478
|
}),
|
|
3370
|
-
outputSchema:
|
|
3371
|
-
outcome:
|
|
3372
|
-
output:
|
|
3479
|
+
outputSchema: import_v49.z.object({
|
|
3480
|
+
outcome: import_v49.z.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
|
|
3481
|
+
output: import_v49.z.string().describe("The output from the code execution.")
|
|
3373
3482
|
})
|
|
3374
3483
|
});
|
|
3375
3484
|
|
|
3376
3485
|
// src/tool/enterprise-web-search.ts
|
|
3377
3486
|
var import_provider_utils11 = require("@ai-sdk/provider-utils");
|
|
3378
|
-
var
|
|
3487
|
+
var import_v410 = require("zod/v4");
|
|
3379
3488
|
var enterpriseWebSearch = (0, import_provider_utils11.createProviderToolFactory)({
|
|
3380
3489
|
id: "google.enterprise_web_search",
|
|
3381
|
-
inputSchema: (0, import_provider_utils11.lazySchema)(() => (0, import_provider_utils11.zodSchema)(
|
|
3490
|
+
inputSchema: (0, import_provider_utils11.lazySchema)(() => (0, import_provider_utils11.zodSchema)(import_v410.z.object({})))
|
|
3382
3491
|
});
|
|
3383
3492
|
|
|
3384
3493
|
// src/tool/file-search.ts
|
|
3385
3494
|
var import_provider_utils12 = require("@ai-sdk/provider-utils");
|
|
3386
|
-
var
|
|
3387
|
-
var fileSearchArgsBaseSchema = () =>
|
|
3495
|
+
var import_v411 = require("zod/v4");
|
|
3496
|
+
var fileSearchArgsBaseSchema = () => import_v411.z.object({
|
|
3388
3497
|
/** The names of the file_search_stores to retrieve from.
|
|
3389
3498
|
* Example: `fileSearchStores/my-file-search-store-123`
|
|
3390
3499
|
*/
|
|
3391
|
-
fileSearchStoreNames:
|
|
3500
|
+
fileSearchStoreNames: import_v411.z.array(import_v411.z.string()).describe(
|
|
3392
3501
|
"The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
|
|
3393
3502
|
),
|
|
3394
3503
|
/** The number of file search retrieval chunks to retrieve. */
|
|
3395
|
-
topK:
|
|
3504
|
+
topK: import_v411.z.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
|
|
3396
3505
|
/** Metadata filter to apply to the file search retrieval documents.
|
|
3397
3506
|
* See https://google.aip.dev/160 for the syntax of the filter expression.
|
|
3398
3507
|
*/
|
|
3399
|
-
metadataFilter:
|
|
3508
|
+
metadataFilter: import_v411.z.string().describe(
|
|
3400
3509
|
"Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
|
|
3401
3510
|
).optional()
|
|
3402
3511
|
}).passthrough();
|
|
@@ -3410,23 +3519,23 @@ var fileSearch = (0, import_provider_utils12.createProviderToolFactory)({
|
|
|
3410
3519
|
|
|
3411
3520
|
// src/tool/google-maps.ts
|
|
3412
3521
|
var import_provider_utils13 = require("@ai-sdk/provider-utils");
|
|
3413
|
-
var
|
|
3522
|
+
var import_v412 = require("zod/v4");
|
|
3414
3523
|
var googleMaps = (0, import_provider_utils13.createProviderToolFactory)({
|
|
3415
3524
|
id: "google.google_maps",
|
|
3416
|
-
inputSchema: (0, import_provider_utils13.lazySchema)(() => (0, import_provider_utils13.zodSchema)(
|
|
3525
|
+
inputSchema: (0, import_provider_utils13.lazySchema)(() => (0, import_provider_utils13.zodSchema)(import_v412.z.object({})))
|
|
3417
3526
|
});
|
|
3418
3527
|
|
|
3419
3528
|
// src/tool/google-search.ts
|
|
3420
3529
|
var import_provider_utils14 = require("@ai-sdk/provider-utils");
|
|
3421
|
-
var
|
|
3422
|
-
var googleSearchToolArgsBaseSchema = () =>
|
|
3423
|
-
searchTypes:
|
|
3424
|
-
webSearch:
|
|
3425
|
-
imageSearch:
|
|
3530
|
+
var import_v413 = require("zod/v4");
|
|
3531
|
+
var googleSearchToolArgsBaseSchema = () => import_v413.z.object({
|
|
3532
|
+
searchTypes: import_v413.z.object({
|
|
3533
|
+
webSearch: import_v413.z.object({}).optional(),
|
|
3534
|
+
imageSearch: import_v413.z.object({}).optional()
|
|
3426
3535
|
}).optional(),
|
|
3427
|
-
timeRangeFilter:
|
|
3428
|
-
startTime:
|
|
3429
|
-
endTime:
|
|
3536
|
+
timeRangeFilter: import_v413.z.object({
|
|
3537
|
+
startTime: import_v413.z.string(),
|
|
3538
|
+
endTime: import_v413.z.string()
|
|
3430
3539
|
}).optional()
|
|
3431
3540
|
}).passthrough();
|
|
3432
3541
|
var googleSearchToolArgsSchema = (0, import_provider_utils14.lazySchema)(
|
|
@@ -3441,20 +3550,20 @@ var googleSearch = (0, import_provider_utils14.createProviderToolFactory)(
|
|
|
3441
3550
|
|
|
3442
3551
|
// src/tool/url-context.ts
|
|
3443
3552
|
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
3444
|
-
var
|
|
3553
|
+
var import_v414 = require("zod/v4");
|
|
3445
3554
|
var urlContext = (0, import_provider_utils15.createProviderToolFactory)({
|
|
3446
3555
|
id: "google.url_context",
|
|
3447
|
-
inputSchema: (0, import_provider_utils15.lazySchema)(() => (0, import_provider_utils15.zodSchema)(
|
|
3556
|
+
inputSchema: (0, import_provider_utils15.lazySchema)(() => (0, import_provider_utils15.zodSchema)(import_v414.z.object({})))
|
|
3448
3557
|
});
|
|
3449
3558
|
|
|
3450
3559
|
// src/tool/vertex-rag-store.ts
|
|
3451
3560
|
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
3452
|
-
var
|
|
3561
|
+
var import_v415 = require("zod/v4");
|
|
3453
3562
|
var vertexRagStore = (0, import_provider_utils16.createProviderToolFactory)({
|
|
3454
3563
|
id: "google.vertex_rag_store",
|
|
3455
|
-
inputSchema:
|
|
3456
|
-
ragCorpus:
|
|
3457
|
-
topK:
|
|
3564
|
+
inputSchema: import_v415.z.object({
|
|
3565
|
+
ragCorpus: import_v415.z.string(),
|
|
3566
|
+
topK: import_v415.z.number().optional()
|
|
3458
3567
|
})
|
|
3459
3568
|
});
|
|
3460
3569
|
|
|
@@ -3520,7 +3629,7 @@ var googleTools = {
|
|
|
3520
3629
|
|
|
3521
3630
|
// src/google-generative-ai-image-model.ts
|
|
3522
3631
|
var import_provider_utils17 = require("@ai-sdk/provider-utils");
|
|
3523
|
-
var
|
|
3632
|
+
var import_v416 = require("zod/v4");
|
|
3524
3633
|
var GoogleGenerativeAIImageModel = class {
|
|
3525
3634
|
constructor(modelId, settings, config) {
|
|
3526
3635
|
this.modelId = modelId;
|
|
@@ -3776,11 +3885,11 @@ function isGeminiModel(modelId) {
|
|
|
3776
3885
|
}
|
|
3777
3886
|
var googleImageResponseSchema = (0, import_provider_utils17.lazySchema)(
|
|
3778
3887
|
() => (0, import_provider_utils17.zodSchema)(
|
|
3779
|
-
|
|
3780
|
-
predictions:
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3888
|
+
import_v416.z.object({
|
|
3889
|
+
predictions: import_v416.z.array(
|
|
3890
|
+
import_v416.z.union([
|
|
3891
|
+
import_v416.z.object({ bytesBase64Encoded: import_v416.z.string() }),
|
|
3892
|
+
import_v416.z.object({ raiFilteredReason: import_v416.z.string() })
|
|
3784
3893
|
])
|
|
3785
3894
|
).default([])
|
|
3786
3895
|
})
|
|
@@ -3788,9 +3897,9 @@ var googleImageResponseSchema = (0, import_provider_utils17.lazySchema)(
|
|
|
3788
3897
|
);
|
|
3789
3898
|
var googleImageModelOptionsSchema = (0, import_provider_utils17.lazySchema)(
|
|
3790
3899
|
() => (0, import_provider_utils17.zodSchema)(
|
|
3791
|
-
|
|
3792
|
-
personGeneration:
|
|
3793
|
-
aspectRatio:
|
|
3900
|
+
import_v416.z.object({
|
|
3901
|
+
personGeneration: import_v416.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
3902
|
+
aspectRatio: import_v416.z.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish(),
|
|
3794
3903
|
/**
|
|
3795
3904
|
* Enable Google Search grounding for Gemini image models. The value is
|
|
3796
3905
|
* forwarded as the args of the `google.tools.googleSearch` provider
|
|
@@ -3806,9 +3915,9 @@ var googleImageModelOptionsSchema = (0, import_provider_utils17.lazySchema)(
|
|
|
3806
3915
|
);
|
|
3807
3916
|
|
|
3808
3917
|
// src/google-generative-ai-video-model.ts
|
|
3809
|
-
var
|
|
3918
|
+
var import_provider7 = require("@ai-sdk/provider");
|
|
3810
3919
|
var import_provider_utils18 = require("@ai-sdk/provider-utils");
|
|
3811
|
-
var
|
|
3920
|
+
var import_v417 = require("zod/v4");
|
|
3812
3921
|
function getFirstFrameImage(options) {
|
|
3813
3922
|
var _a2, _b;
|
|
3814
3923
|
return (_b = (_a2 = options.frameImages) == null ? void 0 : _a2.find((frame) => frame.frameType === "first_frame")) == null ? void 0 : _b.image;
|
|
@@ -3981,7 +4090,7 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
3981
4090
|
});
|
|
3982
4091
|
const operationName = operation.name;
|
|
3983
4092
|
if (!operationName) {
|
|
3984
|
-
throw new
|
|
4093
|
+
throw new import_provider7.AISDKError({
|
|
3985
4094
|
name: "GOOGLE_VIDEO_GENERATION_ERROR",
|
|
3986
4095
|
message: "No operation name returned from API"
|
|
3987
4096
|
});
|
|
@@ -3993,14 +4102,14 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
3993
4102
|
let responseHeaders;
|
|
3994
4103
|
while (!finalOperation.done) {
|
|
3995
4104
|
if (Date.now() - startTime > pollTimeoutMs) {
|
|
3996
|
-
throw new
|
|
4105
|
+
throw new import_provider7.AISDKError({
|
|
3997
4106
|
name: "GOOGLE_VIDEO_GENERATION_TIMEOUT",
|
|
3998
4107
|
message: `Video generation timed out after ${pollTimeoutMs}ms`
|
|
3999
4108
|
});
|
|
4000
4109
|
}
|
|
4001
4110
|
await (0, import_provider_utils18.delay)(pollIntervalMs);
|
|
4002
4111
|
if ((_f = options.abortSignal) == null ? void 0 : _f.aborted) {
|
|
4003
|
-
throw new
|
|
4112
|
+
throw new import_provider7.AISDKError({
|
|
4004
4113
|
name: "GOOGLE_VIDEO_GENERATION_ABORTED",
|
|
4005
4114
|
message: "Video generation request was aborted"
|
|
4006
4115
|
});
|
|
@@ -4022,14 +4131,14 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
4022
4131
|
responseHeaders = pollHeaders;
|
|
4023
4132
|
}
|
|
4024
4133
|
if (finalOperation.error) {
|
|
4025
|
-
throw new
|
|
4134
|
+
throw new import_provider7.AISDKError({
|
|
4026
4135
|
name: "GOOGLE_VIDEO_GENERATION_FAILED",
|
|
4027
4136
|
message: `Video generation failed: ${finalOperation.error.message}`
|
|
4028
4137
|
});
|
|
4029
4138
|
}
|
|
4030
4139
|
const response = finalOperation.response;
|
|
4031
4140
|
if (!((_g = response == null ? void 0 : response.generateVideoResponse) == null ? void 0 : _g.generatedSamples) || response.generateVideoResponse.generatedSamples.length === 0) {
|
|
4032
|
-
throw new
|
|
4141
|
+
throw new import_provider7.AISDKError({
|
|
4033
4142
|
name: "GOOGLE_VIDEO_GENERATION_ERROR",
|
|
4034
4143
|
message: `No videos in response. Response: ${JSON.stringify(finalOperation)}`
|
|
4035
4144
|
});
|
|
@@ -4052,7 +4161,7 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
4052
4161
|
}
|
|
4053
4162
|
}
|
|
4054
4163
|
if (videos.length === 0) {
|
|
4055
|
-
throw new
|
|
4164
|
+
throw new import_provider7.AISDKError({
|
|
4056
4165
|
name: "GOOGLE_VIDEO_GENERATION_ERROR",
|
|
4057
4166
|
message: "No valid videos in response"
|
|
4058
4167
|
});
|
|
@@ -4075,20 +4184,20 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
4075
4184
|
};
|
|
4076
4185
|
var googleOperationSchema = (0, import_provider_utils18.lazySchema)(
|
|
4077
4186
|
() => (0, import_provider_utils18.zodSchema)(
|
|
4078
|
-
|
|
4079
|
-
name:
|
|
4080
|
-
done:
|
|
4081
|
-
error:
|
|
4082
|
-
code:
|
|
4083
|
-
message:
|
|
4084
|
-
status:
|
|
4187
|
+
import_v417.z.object({
|
|
4188
|
+
name: import_v417.z.string().nullish(),
|
|
4189
|
+
done: import_v417.z.boolean().nullish(),
|
|
4190
|
+
error: import_v417.z.object({
|
|
4191
|
+
code: import_v417.z.number().nullish(),
|
|
4192
|
+
message: import_v417.z.string(),
|
|
4193
|
+
status: import_v417.z.string().nullish()
|
|
4085
4194
|
}).nullish(),
|
|
4086
|
-
response:
|
|
4087
|
-
generateVideoResponse:
|
|
4088
|
-
generatedSamples:
|
|
4089
|
-
|
|
4090
|
-
video:
|
|
4091
|
-
uri:
|
|
4195
|
+
response: import_v417.z.object({
|
|
4196
|
+
generateVideoResponse: import_v417.z.object({
|
|
4197
|
+
generatedSamples: import_v417.z.array(
|
|
4198
|
+
import_v417.z.object({
|
|
4199
|
+
video: import_v417.z.object({
|
|
4200
|
+
uri: import_v417.z.string().nullish()
|
|
4092
4201
|
}).nullish()
|
|
4093
4202
|
})
|
|
4094
4203
|
).nullish()
|
|
@@ -4099,15 +4208,15 @@ var googleOperationSchema = (0, import_provider_utils18.lazySchema)(
|
|
|
4099
4208
|
);
|
|
4100
4209
|
var googleVideoModelOptionsSchema = (0, import_provider_utils18.lazySchema)(
|
|
4101
4210
|
() => (0, import_provider_utils18.zodSchema)(
|
|
4102
|
-
|
|
4103
|
-
pollIntervalMs:
|
|
4104
|
-
pollTimeoutMs:
|
|
4105
|
-
personGeneration:
|
|
4106
|
-
negativePrompt:
|
|
4107
|
-
referenceImages:
|
|
4108
|
-
|
|
4109
|
-
bytesBase64Encoded:
|
|
4110
|
-
gcsUri:
|
|
4211
|
+
import_v417.z.object({
|
|
4212
|
+
pollIntervalMs: import_v417.z.number().positive().nullish(),
|
|
4213
|
+
pollTimeoutMs: import_v417.z.number().positive().nullish(),
|
|
4214
|
+
personGeneration: import_v417.z.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
|
|
4215
|
+
negativePrompt: import_v417.z.string().nullish(),
|
|
4216
|
+
referenceImages: import_v417.z.array(
|
|
4217
|
+
import_v417.z.object({
|
|
4218
|
+
bytesBase64Encoded: import_v417.z.string().nullish(),
|
|
4219
|
+
gcsUri: import_v417.z.string().nullish()
|
|
4111
4220
|
})
|
|
4112
4221
|
).nullish()
|
|
4113
4222
|
}).passthrough()
|
|
@@ -5272,30 +5381,30 @@ ${block.text}`
|
|
|
5272
5381
|
|
|
5273
5382
|
// src/interactions/google-interactions-api.ts
|
|
5274
5383
|
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
5275
|
-
var
|
|
5276
|
-
var tokenByModalitySchema = () =>
|
|
5277
|
-
modality:
|
|
5278
|
-
tokens:
|
|
5384
|
+
var import_v418 = require("zod/v4");
|
|
5385
|
+
var tokenByModalitySchema = () => import_v418.z.object({
|
|
5386
|
+
modality: import_v418.z.string().nullish(),
|
|
5387
|
+
tokens: import_v418.z.number().nullish()
|
|
5279
5388
|
}).loose();
|
|
5280
|
-
var usageSchema2 = () =>
|
|
5281
|
-
total_input_tokens:
|
|
5282
|
-
total_output_tokens:
|
|
5283
|
-
total_thought_tokens:
|
|
5284
|
-
total_cached_tokens:
|
|
5285
|
-
total_tool_use_tokens:
|
|
5286
|
-
total_tokens:
|
|
5287
|
-
input_tokens_by_modality:
|
|
5288
|
-
output_tokens_by_modality:
|
|
5289
|
-
cached_tokens_by_modality:
|
|
5290
|
-
tool_use_tokens_by_modality:
|
|
5291
|
-
grounding_tool_count:
|
|
5292
|
-
|
|
5293
|
-
type:
|
|
5294
|
-
count:
|
|
5389
|
+
var usageSchema2 = () => import_v418.z.object({
|
|
5390
|
+
total_input_tokens: import_v418.z.number().nullish(),
|
|
5391
|
+
total_output_tokens: import_v418.z.number().nullish(),
|
|
5392
|
+
total_thought_tokens: import_v418.z.number().nullish(),
|
|
5393
|
+
total_cached_tokens: import_v418.z.number().nullish(),
|
|
5394
|
+
total_tool_use_tokens: import_v418.z.number().nullish(),
|
|
5395
|
+
total_tokens: import_v418.z.number().nullish(),
|
|
5396
|
+
input_tokens_by_modality: import_v418.z.array(tokenByModalitySchema()).nullish(),
|
|
5397
|
+
output_tokens_by_modality: import_v418.z.array(tokenByModalitySchema()).nullish(),
|
|
5398
|
+
cached_tokens_by_modality: import_v418.z.array(tokenByModalitySchema()).nullish(),
|
|
5399
|
+
tool_use_tokens_by_modality: import_v418.z.array(tokenByModalitySchema()).nullish(),
|
|
5400
|
+
grounding_tool_count: import_v418.z.array(
|
|
5401
|
+
import_v418.z.object({
|
|
5402
|
+
type: import_v418.z.string().nullish(),
|
|
5403
|
+
count: import_v418.z.number().nullish()
|
|
5295
5404
|
}).loose()
|
|
5296
5405
|
).nullish()
|
|
5297
5406
|
}).loose();
|
|
5298
|
-
var interactionStatusSchema = () =>
|
|
5407
|
+
var interactionStatusSchema = () => import_v418.z.enum([
|
|
5299
5408
|
"in_progress",
|
|
5300
5409
|
"requires_action",
|
|
5301
5410
|
"completed",
|
|
@@ -5304,69 +5413,69 @@ var interactionStatusSchema = () => import_v417.z.enum([
|
|
|
5304
5413
|
"incomplete"
|
|
5305
5414
|
]);
|
|
5306
5415
|
var annotationSchema = () => {
|
|
5307
|
-
const urlCitation =
|
|
5308
|
-
type:
|
|
5309
|
-
url:
|
|
5310
|
-
title:
|
|
5311
|
-
start_index:
|
|
5312
|
-
end_index:
|
|
5416
|
+
const urlCitation = import_v418.z.object({
|
|
5417
|
+
type: import_v418.z.literal("url_citation"),
|
|
5418
|
+
url: import_v418.z.string().nullish(),
|
|
5419
|
+
title: import_v418.z.string().nullish(),
|
|
5420
|
+
start_index: import_v418.z.number().nullish(),
|
|
5421
|
+
end_index: import_v418.z.number().nullish()
|
|
5313
5422
|
}).loose();
|
|
5314
|
-
const fileCitation =
|
|
5315
|
-
type:
|
|
5316
|
-
file_name:
|
|
5317
|
-
document_uri:
|
|
5318
|
-
url:
|
|
5319
|
-
page_number:
|
|
5320
|
-
media_id:
|
|
5321
|
-
start_index:
|
|
5322
|
-
end_index:
|
|
5323
|
-
custom_metadata:
|
|
5423
|
+
const fileCitation = import_v418.z.object({
|
|
5424
|
+
type: import_v418.z.literal("file_citation"),
|
|
5425
|
+
file_name: import_v418.z.string().nullish(),
|
|
5426
|
+
document_uri: import_v418.z.string().nullish(),
|
|
5427
|
+
url: import_v418.z.string().nullish(),
|
|
5428
|
+
page_number: import_v418.z.number().nullish(),
|
|
5429
|
+
media_id: import_v418.z.string().nullish(),
|
|
5430
|
+
start_index: import_v418.z.number().nullish(),
|
|
5431
|
+
end_index: import_v418.z.number().nullish(),
|
|
5432
|
+
custom_metadata: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()).nullish()
|
|
5324
5433
|
}).loose();
|
|
5325
|
-
const placeCitation =
|
|
5326
|
-
type:
|
|
5327
|
-
name:
|
|
5328
|
-
url:
|
|
5329
|
-
place_id:
|
|
5330
|
-
start_index:
|
|
5331
|
-
end_index:
|
|
5434
|
+
const placeCitation = import_v418.z.object({
|
|
5435
|
+
type: import_v418.z.literal("place_citation"),
|
|
5436
|
+
name: import_v418.z.string().nullish(),
|
|
5437
|
+
url: import_v418.z.string().nullish(),
|
|
5438
|
+
place_id: import_v418.z.string().nullish(),
|
|
5439
|
+
start_index: import_v418.z.number().nullish(),
|
|
5440
|
+
end_index: import_v418.z.number().nullish()
|
|
5332
5441
|
}).loose();
|
|
5333
|
-
return
|
|
5442
|
+
return import_v418.z.union([
|
|
5334
5443
|
urlCitation,
|
|
5335
5444
|
fileCitation,
|
|
5336
5445
|
placeCitation,
|
|
5337
|
-
|
|
5446
|
+
import_v418.z.object({ type: import_v418.z.string() }).loose()
|
|
5338
5447
|
]);
|
|
5339
5448
|
};
|
|
5340
|
-
var thoughtSummaryItemSchema = () =>
|
|
5341
|
-
type:
|
|
5342
|
-
text:
|
|
5343
|
-
data:
|
|
5344
|
-
mime_type:
|
|
5449
|
+
var thoughtSummaryItemSchema = () => import_v418.z.object({
|
|
5450
|
+
type: import_v418.z.string(),
|
|
5451
|
+
text: import_v418.z.string().nullish(),
|
|
5452
|
+
data: import_v418.z.string().nullish(),
|
|
5453
|
+
mime_type: import_v418.z.string().nullish()
|
|
5345
5454
|
}).loose();
|
|
5346
5455
|
var contentBlockSchema = () => {
|
|
5347
|
-
const textContent =
|
|
5348
|
-
type:
|
|
5349
|
-
text:
|
|
5350
|
-
annotations:
|
|
5456
|
+
const textContent = import_v418.z.object({
|
|
5457
|
+
type: import_v418.z.literal("text"),
|
|
5458
|
+
text: import_v418.z.string(),
|
|
5459
|
+
annotations: import_v418.z.array(annotationSchema()).nullish()
|
|
5351
5460
|
}).loose();
|
|
5352
|
-
const imageContent =
|
|
5353
|
-
type:
|
|
5354
|
-
data:
|
|
5355
|
-
mime_type:
|
|
5356
|
-
resolution:
|
|
5357
|
-
uri:
|
|
5461
|
+
const imageContent = import_v418.z.object({
|
|
5462
|
+
type: import_v418.z.literal("image"),
|
|
5463
|
+
data: import_v418.z.string().nullish(),
|
|
5464
|
+
mime_type: import_v418.z.string().nullish(),
|
|
5465
|
+
resolution: import_v418.z.enum(["low", "medium", "high", "ultra_high"]).nullish(),
|
|
5466
|
+
uri: import_v418.z.string().nullish()
|
|
5358
5467
|
}).loose();
|
|
5359
|
-
const videoContent =
|
|
5360
|
-
type:
|
|
5361
|
-
data:
|
|
5362
|
-
mime_type:
|
|
5363
|
-
uri:
|
|
5468
|
+
const videoContent = import_v418.z.object({
|
|
5469
|
+
type: import_v418.z.literal("video"),
|
|
5470
|
+
data: import_v418.z.string().nullish(),
|
|
5471
|
+
mime_type: import_v418.z.string().nullish(),
|
|
5472
|
+
uri: import_v418.z.string().nullish()
|
|
5364
5473
|
}).loose();
|
|
5365
|
-
return
|
|
5474
|
+
return import_v418.z.union([
|
|
5366
5475
|
textContent,
|
|
5367
5476
|
imageContent,
|
|
5368
5477
|
videoContent,
|
|
5369
|
-
|
|
5478
|
+
import_v418.z.object({ type: import_v418.z.string() }).loose()
|
|
5370
5479
|
]);
|
|
5371
5480
|
};
|
|
5372
5481
|
var BUILTIN_TOOL_CALL_STEP_TYPES = [
|
|
@@ -5386,73 +5495,73 @@ var BUILTIN_TOOL_RESULT_STEP_TYPES = [
|
|
|
5386
5495
|
"mcp_server_tool_result"
|
|
5387
5496
|
];
|
|
5388
5497
|
var stepSchema = () => {
|
|
5389
|
-
const userInputStep =
|
|
5390
|
-
type:
|
|
5391
|
-
content:
|
|
5498
|
+
const userInputStep = import_v418.z.object({
|
|
5499
|
+
type: import_v418.z.literal("user_input"),
|
|
5500
|
+
content: import_v418.z.array(contentBlockSchema()).nullish()
|
|
5392
5501
|
}).loose();
|
|
5393
|
-
const modelOutputStep =
|
|
5394
|
-
type:
|
|
5395
|
-
content:
|
|
5502
|
+
const modelOutputStep = import_v418.z.object({
|
|
5503
|
+
type: import_v418.z.literal("model_output"),
|
|
5504
|
+
content: import_v418.z.array(contentBlockSchema()).nullish()
|
|
5396
5505
|
}).loose();
|
|
5397
|
-
const functionCallStep =
|
|
5398
|
-
type:
|
|
5399
|
-
id:
|
|
5400
|
-
name:
|
|
5401
|
-
arguments:
|
|
5402
|
-
signature:
|
|
5506
|
+
const functionCallStep = import_v418.z.object({
|
|
5507
|
+
type: import_v418.z.literal("function_call"),
|
|
5508
|
+
id: import_v418.z.string(),
|
|
5509
|
+
name: import_v418.z.string(),
|
|
5510
|
+
arguments: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()).nullish(),
|
|
5511
|
+
signature: import_v418.z.string().nullish()
|
|
5403
5512
|
}).loose();
|
|
5404
|
-
const thoughtStep =
|
|
5405
|
-
type:
|
|
5406
|
-
signature:
|
|
5407
|
-
summary:
|
|
5513
|
+
const thoughtStep = import_v418.z.object({
|
|
5514
|
+
type: import_v418.z.literal("thought"),
|
|
5515
|
+
signature: import_v418.z.string().nullish(),
|
|
5516
|
+
summary: import_v418.z.array(thoughtSummaryItemSchema()).nullish()
|
|
5408
5517
|
}).loose();
|
|
5409
|
-
const builtinToolCallStep =
|
|
5410
|
-
type:
|
|
5411
|
-
id:
|
|
5412
|
-
arguments:
|
|
5413
|
-
name:
|
|
5414
|
-
server_name:
|
|
5415
|
-
search_type:
|
|
5416
|
-
signature:
|
|
5518
|
+
const builtinToolCallStep = import_v418.z.object({
|
|
5519
|
+
type: import_v418.z.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
|
|
5520
|
+
id: import_v418.z.string(),
|
|
5521
|
+
arguments: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()).nullish(),
|
|
5522
|
+
name: import_v418.z.string().nullish(),
|
|
5523
|
+
server_name: import_v418.z.string().nullish(),
|
|
5524
|
+
search_type: import_v418.z.string().nullish(),
|
|
5525
|
+
signature: import_v418.z.string().nullish()
|
|
5417
5526
|
}).loose();
|
|
5418
|
-
const builtinToolResultStep =
|
|
5419
|
-
type:
|
|
5420
|
-
call_id:
|
|
5421
|
-
result:
|
|
5422
|
-
is_error:
|
|
5423
|
-
name:
|
|
5424
|
-
server_name:
|
|
5425
|
-
signature:
|
|
5527
|
+
const builtinToolResultStep = import_v418.z.object({
|
|
5528
|
+
type: import_v418.z.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
|
|
5529
|
+
call_id: import_v418.z.string(),
|
|
5530
|
+
result: import_v418.z.unknown().nullish(),
|
|
5531
|
+
is_error: import_v418.z.boolean().nullish(),
|
|
5532
|
+
name: import_v418.z.string().nullish(),
|
|
5533
|
+
server_name: import_v418.z.string().nullish(),
|
|
5534
|
+
signature: import_v418.z.string().nullish()
|
|
5426
5535
|
}).loose();
|
|
5427
|
-
return
|
|
5536
|
+
return import_v418.z.union([
|
|
5428
5537
|
userInputStep,
|
|
5429
5538
|
modelOutputStep,
|
|
5430
5539
|
functionCallStep,
|
|
5431
5540
|
thoughtStep,
|
|
5432
5541
|
builtinToolCallStep,
|
|
5433
5542
|
builtinToolResultStep,
|
|
5434
|
-
|
|
5543
|
+
import_v418.z.object({ type: import_v418.z.string() }).loose()
|
|
5435
5544
|
]);
|
|
5436
5545
|
};
|
|
5437
5546
|
var googleInteractionsResponseSchema = (0, import_provider_utils20.lazySchema)(
|
|
5438
5547
|
() => (0, import_provider_utils20.zodSchema)(
|
|
5439
|
-
|
|
5548
|
+
import_v418.z.object({
|
|
5440
5549
|
/*
|
|
5441
5550
|
* `id` is omitted from the response body when `store: false` (fully
|
|
5442
5551
|
* stateless mode) — there is no server-side interaction record for the
|
|
5443
5552
|
* client to reference. `nullish` lets the schema accept that shape.
|
|
5444
5553
|
*/
|
|
5445
|
-
id:
|
|
5446
|
-
created:
|
|
5447
|
-
updated:
|
|
5554
|
+
id: import_v418.z.string().nullish(),
|
|
5555
|
+
created: import_v418.z.string().nullish(),
|
|
5556
|
+
updated: import_v418.z.string().nullish(),
|
|
5448
5557
|
status: interactionStatusSchema(),
|
|
5449
|
-
model:
|
|
5450
|
-
agent:
|
|
5451
|
-
steps:
|
|
5558
|
+
model: import_v418.z.string().nullish(),
|
|
5559
|
+
agent: import_v418.z.string().nullish(),
|
|
5560
|
+
steps: import_v418.z.array(stepSchema()).nullish(),
|
|
5452
5561
|
usage: usageSchema2().nullish(),
|
|
5453
|
-
service_tier:
|
|
5454
|
-
previous_interaction_id:
|
|
5455
|
-
response_modalities:
|
|
5562
|
+
service_tier: import_v418.z.string().nullish(),
|
|
5563
|
+
previous_interaction_id: import_v418.z.string().nullish(),
|
|
5564
|
+
response_modalities: import_v418.z.array(import_v418.z.string()).nullish()
|
|
5456
5565
|
}).loose()
|
|
5457
5566
|
)
|
|
5458
5567
|
);
|
|
@@ -5462,82 +5571,82 @@ var googleInteractionsEventSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
5462
5571
|
const status = interactionStatusSchema();
|
|
5463
5572
|
const annotation = annotationSchema();
|
|
5464
5573
|
const thoughtSummaryItem = thoughtSummaryItemSchema();
|
|
5465
|
-
const interactionCreatedEvent =
|
|
5466
|
-
event_type:
|
|
5467
|
-
event_id:
|
|
5468
|
-
interaction:
|
|
5574
|
+
const interactionCreatedEvent = import_v418.z.object({
|
|
5575
|
+
event_type: import_v418.z.literal("interaction.created"),
|
|
5576
|
+
event_id: import_v418.z.string().nullish(),
|
|
5577
|
+
interaction: import_v418.z.object({
|
|
5469
5578
|
/*
|
|
5470
5579
|
* `id` is omitted when `store: false` (fully stateless mode);
|
|
5471
5580
|
* see the matching note on `googleInteractionsResponseSchema.id`.
|
|
5472
5581
|
*/
|
|
5473
|
-
id:
|
|
5474
|
-
created:
|
|
5475
|
-
model:
|
|
5476
|
-
agent:
|
|
5582
|
+
id: import_v418.z.string().nullish(),
|
|
5583
|
+
created: import_v418.z.string().nullish(),
|
|
5584
|
+
model: import_v418.z.string().nullish(),
|
|
5585
|
+
agent: import_v418.z.string().nullish(),
|
|
5477
5586
|
status: status.nullish()
|
|
5478
5587
|
}).loose()
|
|
5479
5588
|
}).loose();
|
|
5480
|
-
const stepStartEvent =
|
|
5481
|
-
event_type:
|
|
5482
|
-
event_id:
|
|
5483
|
-
index:
|
|
5589
|
+
const stepStartEvent = import_v418.z.object({
|
|
5590
|
+
event_type: import_v418.z.literal("step.start"),
|
|
5591
|
+
event_id: import_v418.z.string().nullish(),
|
|
5592
|
+
index: import_v418.z.number(),
|
|
5484
5593
|
step: stepSchema()
|
|
5485
5594
|
}).loose();
|
|
5486
|
-
const stepDeltaText =
|
|
5487
|
-
type:
|
|
5488
|
-
text:
|
|
5595
|
+
const stepDeltaText = import_v418.z.object({
|
|
5596
|
+
type: import_v418.z.literal("text"),
|
|
5597
|
+
text: import_v418.z.string()
|
|
5489
5598
|
}).loose();
|
|
5490
|
-
const stepDeltaThoughtSummary =
|
|
5491
|
-
type:
|
|
5599
|
+
const stepDeltaThoughtSummary = import_v418.z.object({
|
|
5600
|
+
type: import_v418.z.literal("thought_summary"),
|
|
5492
5601
|
content: thoughtSummaryItem.nullish()
|
|
5493
5602
|
}).loose();
|
|
5494
|
-
const stepDeltaThoughtSignature =
|
|
5495
|
-
type:
|
|
5496
|
-
signature:
|
|
5603
|
+
const stepDeltaThoughtSignature = import_v418.z.object({
|
|
5604
|
+
type: import_v418.z.literal("thought_signature"),
|
|
5605
|
+
signature: import_v418.z.string().nullish()
|
|
5497
5606
|
}).loose();
|
|
5498
|
-
const stepDeltaArgumentsDelta =
|
|
5499
|
-
type:
|
|
5500
|
-
arguments:
|
|
5501
|
-
id:
|
|
5502
|
-
signature:
|
|
5607
|
+
const stepDeltaArgumentsDelta = import_v418.z.object({
|
|
5608
|
+
type: import_v418.z.literal("arguments_delta"),
|
|
5609
|
+
arguments: import_v418.z.string().nullish(),
|
|
5610
|
+
id: import_v418.z.string().nullish(),
|
|
5611
|
+
signature: import_v418.z.string().nullish()
|
|
5503
5612
|
}).loose();
|
|
5504
|
-
const stepDeltaTextAnnotation =
|
|
5505
|
-
type:
|
|
5506
|
-
annotations:
|
|
5613
|
+
const stepDeltaTextAnnotation = import_v418.z.object({
|
|
5614
|
+
type: import_v418.z.enum(["text_annotation_delta", "text_annotation"]),
|
|
5615
|
+
annotations: import_v418.z.array(annotation).nullish()
|
|
5507
5616
|
}).loose();
|
|
5508
|
-
const stepDeltaImage =
|
|
5509
|
-
type:
|
|
5510
|
-
data:
|
|
5511
|
-
mime_type:
|
|
5512
|
-
resolution:
|
|
5513
|
-
uri:
|
|
5617
|
+
const stepDeltaImage = import_v418.z.object({
|
|
5618
|
+
type: import_v418.z.literal("image"),
|
|
5619
|
+
data: import_v418.z.string().nullish(),
|
|
5620
|
+
mime_type: import_v418.z.string().nullish(),
|
|
5621
|
+
resolution: import_v418.z.enum(["low", "medium", "high", "ultra_high"]).nullish(),
|
|
5622
|
+
uri: import_v418.z.string().nullish()
|
|
5514
5623
|
}).loose();
|
|
5515
|
-
const stepDeltaVideo =
|
|
5516
|
-
type:
|
|
5517
|
-
data:
|
|
5518
|
-
mime_type:
|
|
5519
|
-
uri:
|
|
5624
|
+
const stepDeltaVideo = import_v418.z.object({
|
|
5625
|
+
type: import_v418.z.literal("video"),
|
|
5626
|
+
data: import_v418.z.string().nullish(),
|
|
5627
|
+
mime_type: import_v418.z.string().nullish(),
|
|
5628
|
+
uri: import_v418.z.string().nullish()
|
|
5520
5629
|
}).loose();
|
|
5521
|
-
const stepDeltaBuiltinToolCall =
|
|
5522
|
-
type:
|
|
5523
|
-
id:
|
|
5524
|
-
arguments:
|
|
5525
|
-
name:
|
|
5526
|
-
server_name:
|
|
5527
|
-
search_type:
|
|
5528
|
-
signature:
|
|
5630
|
+
const stepDeltaBuiltinToolCall = import_v418.z.object({
|
|
5631
|
+
type: import_v418.z.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
|
|
5632
|
+
id: import_v418.z.string().nullish(),
|
|
5633
|
+
arguments: import_v418.z.record(import_v418.z.string(), import_v418.z.unknown()).nullish(),
|
|
5634
|
+
name: import_v418.z.string().nullish(),
|
|
5635
|
+
server_name: import_v418.z.string().nullish(),
|
|
5636
|
+
search_type: import_v418.z.string().nullish(),
|
|
5637
|
+
signature: import_v418.z.string().nullish()
|
|
5529
5638
|
}).loose();
|
|
5530
|
-
const stepDeltaBuiltinToolResult =
|
|
5531
|
-
type:
|
|
5532
|
-
call_id:
|
|
5533
|
-
result:
|
|
5534
|
-
is_error:
|
|
5535
|
-
name:
|
|
5536
|
-
server_name:
|
|
5537
|
-
signature:
|
|
5639
|
+
const stepDeltaBuiltinToolResult = import_v418.z.object({
|
|
5640
|
+
type: import_v418.z.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
|
|
5641
|
+
call_id: import_v418.z.string().nullish(),
|
|
5642
|
+
result: import_v418.z.unknown().nullish(),
|
|
5643
|
+
is_error: import_v418.z.boolean().nullish(),
|
|
5644
|
+
name: import_v418.z.string().nullish(),
|
|
5645
|
+
server_name: import_v418.z.string().nullish(),
|
|
5646
|
+
signature: import_v418.z.string().nullish()
|
|
5538
5647
|
}).loose();
|
|
5539
|
-
const stepDeltaUnknown =
|
|
5540
|
-
const stepDeltaUnion =
|
|
5648
|
+
const stepDeltaUnknown = import_v418.z.object({ type: import_v418.z.string() }).loose();
|
|
5649
|
+
const stepDeltaUnion = import_v418.z.union([
|
|
5541
5650
|
stepDeltaText,
|
|
5542
5651
|
stepDeltaImage,
|
|
5543
5652
|
stepDeltaVideo,
|
|
@@ -5549,55 +5658,55 @@ var googleInteractionsEventSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
5549
5658
|
stepDeltaBuiltinToolResult,
|
|
5550
5659
|
stepDeltaUnknown
|
|
5551
5660
|
]);
|
|
5552
|
-
const stepDeltaEvent =
|
|
5553
|
-
event_type:
|
|
5554
|
-
event_id:
|
|
5555
|
-
index:
|
|
5661
|
+
const stepDeltaEvent = import_v418.z.object({
|
|
5662
|
+
event_type: import_v418.z.literal("step.delta"),
|
|
5663
|
+
event_id: import_v418.z.string().nullish(),
|
|
5664
|
+
index: import_v418.z.number(),
|
|
5556
5665
|
delta: stepDeltaUnion
|
|
5557
5666
|
}).loose();
|
|
5558
|
-
const stepStopEvent =
|
|
5559
|
-
event_type:
|
|
5560
|
-
event_id:
|
|
5561
|
-
index:
|
|
5667
|
+
const stepStopEvent = import_v418.z.object({
|
|
5668
|
+
event_type: import_v418.z.literal("step.stop"),
|
|
5669
|
+
event_id: import_v418.z.string().nullish(),
|
|
5670
|
+
index: import_v418.z.number()
|
|
5562
5671
|
}).loose();
|
|
5563
|
-
const interactionStatusUpdateEvent =
|
|
5564
|
-
event_type:
|
|
5565
|
-
event_id:
|
|
5566
|
-
interaction_id:
|
|
5672
|
+
const interactionStatusUpdateEvent = import_v418.z.object({
|
|
5673
|
+
event_type: import_v418.z.literal("interaction.status_update"),
|
|
5674
|
+
event_id: import_v418.z.string().nullish(),
|
|
5675
|
+
interaction_id: import_v418.z.string().nullish(),
|
|
5567
5676
|
status: status.nullish()
|
|
5568
5677
|
}).loose();
|
|
5569
|
-
const interactionInProgressEvent =
|
|
5570
|
-
event_type:
|
|
5571
|
-
event_id:
|
|
5572
|
-
interaction_id:
|
|
5678
|
+
const interactionInProgressEvent = import_v418.z.object({
|
|
5679
|
+
event_type: import_v418.z.literal("interaction.in_progress"),
|
|
5680
|
+
event_id: import_v418.z.string().nullish(),
|
|
5681
|
+
interaction_id: import_v418.z.string().nullish(),
|
|
5573
5682
|
status: status.nullish()
|
|
5574
5683
|
}).loose();
|
|
5575
|
-
const interactionRequiresActionEvent =
|
|
5576
|
-
event_type:
|
|
5577
|
-
event_id:
|
|
5578
|
-
interaction_id:
|
|
5684
|
+
const interactionRequiresActionEvent = import_v418.z.object({
|
|
5685
|
+
event_type: import_v418.z.literal("interaction.requires_action"),
|
|
5686
|
+
event_id: import_v418.z.string().nullish(),
|
|
5687
|
+
interaction_id: import_v418.z.string().nullish(),
|
|
5579
5688
|
status: status.nullish()
|
|
5580
5689
|
}).loose();
|
|
5581
|
-
const interactionCompletedEvent =
|
|
5582
|
-
event_type:
|
|
5583
|
-
event_id:
|
|
5584
|
-
interaction:
|
|
5585
|
-
id:
|
|
5690
|
+
const interactionCompletedEvent = import_v418.z.object({
|
|
5691
|
+
event_type: import_v418.z.literal("interaction.completed"),
|
|
5692
|
+
event_id: import_v418.z.string().nullish(),
|
|
5693
|
+
interaction: import_v418.z.object({
|
|
5694
|
+
id: import_v418.z.string().nullish(),
|
|
5586
5695
|
status: status.nullish(),
|
|
5587
5696
|
usage: usageSchema2().nullish(),
|
|
5588
|
-
service_tier:
|
|
5697
|
+
service_tier: import_v418.z.string().nullish()
|
|
5589
5698
|
}).loose()
|
|
5590
5699
|
}).loose();
|
|
5591
|
-
const errorEvent =
|
|
5592
|
-
event_type:
|
|
5593
|
-
event_id:
|
|
5594
|
-
error:
|
|
5595
|
-
code:
|
|
5596
|
-
message:
|
|
5700
|
+
const errorEvent = import_v418.z.object({
|
|
5701
|
+
event_type: import_v418.z.literal("error"),
|
|
5702
|
+
event_id: import_v418.z.string().nullish(),
|
|
5703
|
+
error: import_v418.z.object({
|
|
5704
|
+
code: import_v418.z.string().nullish(),
|
|
5705
|
+
message: import_v418.z.string().nullish()
|
|
5597
5706
|
}).loose().nullish()
|
|
5598
5707
|
}).loose();
|
|
5599
|
-
const unknownEvent =
|
|
5600
|
-
return
|
|
5708
|
+
const unknownEvent = import_v418.z.object({ event_type: import_v418.z.string() }).loose();
|
|
5709
|
+
return import_v418.z.union([
|
|
5601
5710
|
interactionCreatedEvent,
|
|
5602
5711
|
stepStartEvent,
|
|
5603
5712
|
stepDeltaEvent,
|
|
@@ -5615,26 +5724,26 @@ var googleInteractionsEventSchema = (0, import_provider_utils20.lazySchema)(
|
|
|
5615
5724
|
|
|
5616
5725
|
// src/interactions/google-interactions-language-model-options.ts
|
|
5617
5726
|
var import_provider_utils21 = require("@ai-sdk/provider-utils");
|
|
5618
|
-
var
|
|
5727
|
+
var import_v419 = require("zod/v4");
|
|
5619
5728
|
var googleInteractionsLanguageModelOptions = (0, import_provider_utils21.lazySchema)(
|
|
5620
5729
|
() => (0, import_provider_utils21.zodSchema)(
|
|
5621
|
-
|
|
5622
|
-
previousInteractionId:
|
|
5623
|
-
store:
|
|
5624
|
-
agent:
|
|
5625
|
-
agentConfig:
|
|
5626
|
-
|
|
5627
|
-
type:
|
|
5730
|
+
import_v419.z.object({
|
|
5731
|
+
previousInteractionId: import_v419.z.string().nullish(),
|
|
5732
|
+
store: import_v419.z.boolean().nullish(),
|
|
5733
|
+
agent: import_v419.z.string().nullish(),
|
|
5734
|
+
agentConfig: import_v419.z.union([
|
|
5735
|
+
import_v419.z.object({
|
|
5736
|
+
type: import_v419.z.literal("dynamic")
|
|
5628
5737
|
}).loose(),
|
|
5629
|
-
|
|
5630
|
-
type:
|
|
5631
|
-
thinkingSummaries:
|
|
5632
|
-
visualization:
|
|
5633
|
-
collaborativePlanning:
|
|
5738
|
+
import_v419.z.object({
|
|
5739
|
+
type: import_v419.z.literal("deep-research"),
|
|
5740
|
+
thinkingSummaries: import_v419.z.enum(["auto", "none"]).nullish(),
|
|
5741
|
+
visualization: import_v419.z.enum(["off", "auto"]).nullish(),
|
|
5742
|
+
collaborativePlanning: import_v419.z.boolean().nullish()
|
|
5634
5743
|
})
|
|
5635
5744
|
]).nullish(),
|
|
5636
|
-
thinkingLevel:
|
|
5637
|
-
thinkingSummaries:
|
|
5745
|
+
thinkingLevel: import_v419.z.enum(["minimal", "low", "medium", "high"]).nullish(),
|
|
5746
|
+
thinkingSummaries: import_v419.z.enum(["auto", "none"]).nullish(),
|
|
5638
5747
|
/**
|
|
5639
5748
|
* Output-format entries that map directly to the API's `response_format`
|
|
5640
5749
|
* array. Use this to request image, audio, video, or non-JSON text
|
|
@@ -5644,17 +5753,17 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils21.lazySch
|
|
|
5644
5753
|
* type: 'json', schema }` still drives JSON-mode and adds a matching
|
|
5645
5754
|
* text entry automatically; entries listed here are appended.
|
|
5646
5755
|
*/
|
|
5647
|
-
responseFormat:
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
type:
|
|
5651
|
-
mimeType:
|
|
5652
|
-
schema:
|
|
5756
|
+
responseFormat: import_v419.z.array(
|
|
5757
|
+
import_v419.z.union([
|
|
5758
|
+
import_v419.z.object({
|
|
5759
|
+
type: import_v419.z.literal("text"),
|
|
5760
|
+
mimeType: import_v419.z.string().nullish(),
|
|
5761
|
+
schema: import_v419.z.unknown().nullish()
|
|
5653
5762
|
}).loose(),
|
|
5654
|
-
|
|
5655
|
-
type:
|
|
5656
|
-
mimeType:
|
|
5657
|
-
aspectRatio:
|
|
5763
|
+
import_v419.z.object({
|
|
5764
|
+
type: import_v419.z.literal("image"),
|
|
5765
|
+
mimeType: import_v419.z.string().nullish(),
|
|
5766
|
+
aspectRatio: import_v419.z.enum([
|
|
5658
5767
|
"1:1",
|
|
5659
5768
|
"2:3",
|
|
5660
5769
|
"3:2",
|
|
@@ -5670,19 +5779,19 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils21.lazySch
|
|
|
5670
5779
|
"1:4",
|
|
5671
5780
|
"4:1"
|
|
5672
5781
|
]).nullish(),
|
|
5673
|
-
imageSize:
|
|
5782
|
+
imageSize: import_v419.z.enum(["1K", "2K", "4K", "512"]).nullish()
|
|
5674
5783
|
}).loose(),
|
|
5675
|
-
|
|
5676
|
-
type:
|
|
5677
|
-
mimeType:
|
|
5784
|
+
import_v419.z.object({
|
|
5785
|
+
type: import_v419.z.literal("audio"),
|
|
5786
|
+
mimeType: import_v419.z.string().nullish()
|
|
5678
5787
|
}).loose(),
|
|
5679
|
-
|
|
5680
|
-
type:
|
|
5681
|
-
aspectRatio:
|
|
5682
|
-
resolution:
|
|
5683
|
-
duration:
|
|
5684
|
-
delivery:
|
|
5685
|
-
gcsUri:
|
|
5788
|
+
import_v419.z.object({
|
|
5789
|
+
type: import_v419.z.literal("video"),
|
|
5790
|
+
aspectRatio: import_v419.z.enum(["16:9", "9:16"]).nullish(),
|
|
5791
|
+
resolution: import_v419.z.enum(["360p", "720p", "1080p", "4k"]).nullish(),
|
|
5792
|
+
duration: import_v419.z.string().nullish(),
|
|
5793
|
+
delivery: import_v419.z.enum(["inline", "uri"]).nullish(),
|
|
5794
|
+
gcsUri: import_v419.z.string().nullish()
|
|
5686
5795
|
}).loose()
|
|
5687
5796
|
])
|
|
5688
5797
|
).nullish(),
|
|
@@ -5692,8 +5801,8 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils21.lazySch
|
|
|
5692
5801
|
* translates it into a matching `response_format` image entry and
|
|
5693
5802
|
* emits a warning when set.
|
|
5694
5803
|
*/
|
|
5695
|
-
imageConfig:
|
|
5696
|
-
aspectRatio:
|
|
5804
|
+
imageConfig: import_v419.z.object({
|
|
5805
|
+
aspectRatio: import_v419.z.enum([
|
|
5697
5806
|
"1:1",
|
|
5698
5807
|
"2:3",
|
|
5699
5808
|
"3:2",
|
|
@@ -5709,35 +5818,35 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils21.lazySch
|
|
|
5709
5818
|
"1:4",
|
|
5710
5819
|
"4:1"
|
|
5711
5820
|
]).nullish(),
|
|
5712
|
-
imageSize:
|
|
5821
|
+
imageSize: import_v419.z.enum(["1K", "2K", "4K", "512"]).nullish()
|
|
5713
5822
|
}).nullish(),
|
|
5714
|
-
mediaResolution:
|
|
5715
|
-
responseModalities:
|
|
5716
|
-
serviceTier:
|
|
5823
|
+
mediaResolution: import_v419.z.enum(["low", "medium", "high", "ultra_high"]).nullish(),
|
|
5824
|
+
responseModalities: import_v419.z.array(import_v419.z.enum(["text", "image", "audio", "video", "document"])).nullish(),
|
|
5825
|
+
serviceTier: import_v419.z.enum(["flex", "standard", "priority"]).nullish(),
|
|
5717
5826
|
/**
|
|
5718
5827
|
* Alternative to AI SDK `system` message. If both are set, the AI SDK
|
|
5719
5828
|
* `system` message wins and a warning is emitted.
|
|
5720
5829
|
*/
|
|
5721
|
-
systemInstruction:
|
|
5830
|
+
systemInstruction: import_v419.z.string().nullish(),
|
|
5722
5831
|
/**
|
|
5723
5832
|
* Per-block signature for round-tripping `thought.signature` and
|
|
5724
5833
|
* `function_call.signature` blocks. Set by the SDK on output reasoning /
|
|
5725
5834
|
* tool-call parts; passed back unchanged on input parts so the API
|
|
5726
5835
|
* accepts the prior turn.
|
|
5727
5836
|
*/
|
|
5728
|
-
signature:
|
|
5837
|
+
signature: import_v419.z.string().nullish(),
|
|
5729
5838
|
/**
|
|
5730
5839
|
* Set by the SDK on output assistant messages. The converter uses it to
|
|
5731
5840
|
* decide which messages to drop when compacting under
|
|
5732
5841
|
* `previousInteractionId`.
|
|
5733
5842
|
*/
|
|
5734
|
-
interactionId:
|
|
5843
|
+
interactionId: import_v419.z.string().nullish(),
|
|
5735
5844
|
/**
|
|
5736
5845
|
* Maximum time, in milliseconds, to poll a background interaction (agent
|
|
5737
5846
|
* call) before giving up. Defaults to 30 minutes. Long-running agents
|
|
5738
5847
|
* such as deep research can take tens of minutes — increase if needed.
|
|
5739
5848
|
*/
|
|
5740
|
-
pollingTimeoutMs:
|
|
5849
|
+
pollingTimeoutMs: import_v419.z.number().int().positive().nullish(),
|
|
5741
5850
|
/**
|
|
5742
5851
|
* Run the interaction in the background. Required for agents whose
|
|
5743
5852
|
* server-side workflow cannot complete within a single request/response.
|
|
@@ -5746,7 +5855,7 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils21.lazySch
|
|
|
5746
5855
|
* reject `true`; see the agent's documentation for which mode it
|
|
5747
5856
|
* requires.
|
|
5748
5857
|
*/
|
|
5749
|
-
background:
|
|
5858
|
+
background: import_v419.z.boolean().nullish(),
|
|
5750
5859
|
/**
|
|
5751
5860
|
* Environment configuration for the agent sandbox. Only applies to agent
|
|
5752
5861
|
* calls (`google.interactions({ agent })`); ignored on model-id calls.
|
|
@@ -5756,36 +5865,36 @@ var googleInteractionsLanguageModelOptions = (0, import_provider_utils21.lazySch
|
|
|
5756
5865
|
* - object: provision a fresh sandbox and optionally preload `sources`
|
|
5757
5866
|
* and/or constrain outbound traffic via `network`.
|
|
5758
5867
|
*/
|
|
5759
|
-
environment:
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
type:
|
|
5763
|
-
sources:
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
type:
|
|
5767
|
-
source:
|
|
5768
|
-
target:
|
|
5868
|
+
environment: import_v419.z.union([
|
|
5869
|
+
import_v419.z.string(),
|
|
5870
|
+
import_v419.z.object({
|
|
5871
|
+
type: import_v419.z.literal("remote"),
|
|
5872
|
+
sources: import_v419.z.array(
|
|
5873
|
+
import_v419.z.union([
|
|
5874
|
+
import_v419.z.object({
|
|
5875
|
+
type: import_v419.z.literal("gcs"),
|
|
5876
|
+
source: import_v419.z.string(),
|
|
5877
|
+
target: import_v419.z.string().nullish()
|
|
5769
5878
|
}),
|
|
5770
|
-
|
|
5771
|
-
type:
|
|
5772
|
-
source:
|
|
5773
|
-
target:
|
|
5879
|
+
import_v419.z.object({
|
|
5880
|
+
type: import_v419.z.literal("repository"),
|
|
5881
|
+
source: import_v419.z.string(),
|
|
5882
|
+
target: import_v419.z.string().nullish()
|
|
5774
5883
|
}),
|
|
5775
|
-
|
|
5776
|
-
type:
|
|
5777
|
-
content:
|
|
5778
|
-
target:
|
|
5884
|
+
import_v419.z.object({
|
|
5885
|
+
type: import_v419.z.literal("inline"),
|
|
5886
|
+
content: import_v419.z.string(),
|
|
5887
|
+
target: import_v419.z.string()
|
|
5779
5888
|
})
|
|
5780
5889
|
])
|
|
5781
5890
|
).nullish(),
|
|
5782
|
-
network:
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
allowlist:
|
|
5786
|
-
|
|
5787
|
-
domain:
|
|
5788
|
-
transform:
|
|
5891
|
+
network: import_v419.z.union([
|
|
5892
|
+
import_v419.z.literal("disabled"),
|
|
5893
|
+
import_v419.z.object({
|
|
5894
|
+
allowlist: import_v419.z.array(
|
|
5895
|
+
import_v419.z.object({
|
|
5896
|
+
domain: import_v419.z.string(),
|
|
5897
|
+
transform: import_v419.z.array(import_v419.z.record(import_v419.z.string(), import_v419.z.string())).nullish()
|
|
5789
5898
|
})
|
|
5790
5899
|
)
|
|
5791
5900
|
})
|
|
@@ -6089,6 +6198,9 @@ function prepareGoogleInteractionsTools({
|
|
|
6089
6198
|
}) {
|
|
6090
6199
|
var _a2, _b, _c, _d;
|
|
6091
6200
|
const toolWarnings = [];
|
|
6201
|
+
if ((toolChoice == null ? void 0 : toolChoice.type) === "none") {
|
|
6202
|
+
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
6203
|
+
}
|
|
6092
6204
|
const normalized = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
6093
6205
|
if (normalized == null) {
|
|
6094
6206
|
return { tools: void 0, toolChoice: void 0, toolWarnings };
|
|
@@ -6210,9 +6322,6 @@ function prepareGoogleInteractionsTools({
|
|
|
6210
6322
|
case "required":
|
|
6211
6323
|
mappedToolChoice = "any";
|
|
6212
6324
|
break;
|
|
6213
|
-
case "none":
|
|
6214
|
-
mappedToolChoice = "none";
|
|
6215
|
-
break;
|
|
6216
6325
|
case "tool":
|
|
6217
6326
|
mappedToolChoice = {
|
|
6218
6327
|
allowed_tools: {
|