@ai-sdk/google 3.0.53 → 3.0.55
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 +12 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +225 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +225 -23
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +15 -0
- package/dist/internal/index.d.ts +15 -0
- package/dist/internal/index.js +224 -22
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +224 -22
- package/dist/internal/index.mjs.map +1 -1
- package/docs/15-google-generative-ai.mdx +6 -0
- package/package.json +5 -5
- package/src/convert-to-google-generative-ai-messages.ts +87 -0
- package/src/google-generative-ai-language-model.ts +127 -0
- package/src/google-generative-ai-options.ts +11 -0
- package/src/google-generative-ai-prompt.ts +18 -1
- package/src/google-prepare-tools.ts +57 -2
package/dist/internal/index.mjs
CHANGED
|
@@ -277,7 +277,7 @@ function appendLegacyToolResultParts(parts, toolName, outputValue) {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
280
|
-
var _a, _b, _c, _d;
|
|
280
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
281
281
|
const systemInstructionParts = [];
|
|
282
282
|
const contents = [];
|
|
283
283
|
let systemMessagesAllowed = true;
|
|
@@ -364,6 +364,18 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
366
|
case "tool-call": {
|
|
367
|
+
const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
|
|
368
|
+
const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
|
|
369
|
+
if (serverToolCallId && serverToolType) {
|
|
370
|
+
return {
|
|
371
|
+
toolCall: {
|
|
372
|
+
toolType: serverToolType,
|
|
373
|
+
args: typeof part.input === "string" ? JSON.parse(part.input) : part.input,
|
|
374
|
+
id: serverToolCallId
|
|
375
|
+
},
|
|
376
|
+
thoughtSignature
|
|
377
|
+
};
|
|
378
|
+
}
|
|
367
379
|
return {
|
|
368
380
|
functionCall: {
|
|
369
381
|
name: part.toolName,
|
|
@@ -372,6 +384,21 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
372
384
|
thoughtSignature
|
|
373
385
|
};
|
|
374
386
|
}
|
|
387
|
+
case "tool-result": {
|
|
388
|
+
const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
|
|
389
|
+
const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
|
|
390
|
+
if (serverToolCallId && serverToolType) {
|
|
391
|
+
return {
|
|
392
|
+
toolResponse: {
|
|
393
|
+
toolType: serverToolType,
|
|
394
|
+
response: part.output.type === "json" ? part.output.value : {},
|
|
395
|
+
id: serverToolCallId
|
|
396
|
+
},
|
|
397
|
+
thoughtSignature
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
return void 0;
|
|
401
|
+
}
|
|
375
402
|
}
|
|
376
403
|
}).filter((part) => part !== void 0)
|
|
377
404
|
});
|
|
@@ -384,6 +411,26 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
384
411
|
if (part.type === "tool-approval-response") {
|
|
385
412
|
continue;
|
|
386
413
|
}
|
|
414
|
+
const partProviderOpts = (_g = (_d = part.providerOptions) == null ? void 0 : _d[providerOptionsName]) != null ? _g : providerOptionsName !== "google" ? (_e = part.providerOptions) == null ? void 0 : _e.google : (_f = part.providerOptions) == null ? void 0 : _f.vertex;
|
|
415
|
+
const serverToolCallId = (partProviderOpts == null ? void 0 : partProviderOpts.serverToolCallId) != null ? String(partProviderOpts.serverToolCallId) : void 0;
|
|
416
|
+
const serverToolType = (partProviderOpts == null ? void 0 : partProviderOpts.serverToolType) != null ? String(partProviderOpts.serverToolType) : void 0;
|
|
417
|
+
if (serverToolCallId && serverToolType) {
|
|
418
|
+
const serverThoughtSignature = (partProviderOpts == null ? void 0 : partProviderOpts.thoughtSignature) != null ? String(partProviderOpts.thoughtSignature) : void 0;
|
|
419
|
+
if (contents.length > 0) {
|
|
420
|
+
const lastContent = contents[contents.length - 1];
|
|
421
|
+
if (lastContent.role === "model") {
|
|
422
|
+
lastContent.parts.push({
|
|
423
|
+
toolResponse: {
|
|
424
|
+
toolType: serverToolType,
|
|
425
|
+
response: part.output.type === "json" ? part.output.value : {},
|
|
426
|
+
id: serverToolCallId
|
|
427
|
+
},
|
|
428
|
+
thoughtSignature: serverThoughtSignature
|
|
429
|
+
});
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
387
434
|
const output = part.output;
|
|
388
435
|
if (output.type === "content") {
|
|
389
436
|
if (supportsFunctionResponseParts) {
|
|
@@ -397,7 +444,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
397
444
|
name: part.toolName,
|
|
398
445
|
response: {
|
|
399
446
|
name: part.toolName,
|
|
400
|
-
content: output.type === "execution-denied" ? (
|
|
447
|
+
content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool execution denied." : output.value
|
|
401
448
|
}
|
|
402
449
|
}
|
|
403
450
|
});
|
|
@@ -566,7 +613,15 @@ var googleLanguageModelOptions = lazySchema2(
|
|
|
566
613
|
latitude: z2.number(),
|
|
567
614
|
longitude: z2.number()
|
|
568
615
|
}).optional()
|
|
569
|
-
}).optional()
|
|
616
|
+
}).optional(),
|
|
617
|
+
/**
|
|
618
|
+
* Optional. The service tier to use for the request.
|
|
619
|
+
*/
|
|
620
|
+
serviceTier: z2.enum([
|
|
621
|
+
"SERVICE_TIER_STANDARD",
|
|
622
|
+
"SERVICE_TIER_FLEX",
|
|
623
|
+
"SERVICE_TIER_PRIORITY"
|
|
624
|
+
]).optional()
|
|
570
625
|
})
|
|
571
626
|
)
|
|
572
627
|
);
|
|
@@ -580,7 +635,7 @@ function prepareTools({
|
|
|
580
635
|
toolChoice,
|
|
581
636
|
modelId
|
|
582
637
|
}) {
|
|
583
|
-
var _a;
|
|
638
|
+
var _a, _b;
|
|
584
639
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
585
640
|
const toolWarnings = [];
|
|
586
641
|
const isLatest = [
|
|
@@ -589,13 +644,14 @@ function prepareTools({
|
|
|
589
644
|
"gemini-pro-latest"
|
|
590
645
|
].some((id) => id === modelId);
|
|
591
646
|
const isGemini2orNewer = modelId.includes("gemini-2") || modelId.includes("gemini-3") || modelId.includes("nano-banana") || isLatest;
|
|
647
|
+
const isGemini3orNewer = modelId.includes("gemini-3");
|
|
592
648
|
const supportsFileSearch = modelId.includes("gemini-2.5") || modelId.includes("gemini-3");
|
|
593
649
|
if (tools == null) {
|
|
594
650
|
return { tools: void 0, toolConfig: void 0, toolWarnings };
|
|
595
651
|
}
|
|
596
652
|
const hasFunctionTools = tools.some((tool) => tool.type === "function");
|
|
597
653
|
const hasProviderTools = tools.some((tool) => tool.type === "provider");
|
|
598
|
-
if (hasFunctionTools && hasProviderTools) {
|
|
654
|
+
if (hasFunctionTools && hasProviderTools && !isGemini3orNewer) {
|
|
599
655
|
toolWarnings.push({
|
|
600
656
|
type: "unsupported",
|
|
601
657
|
feature: `combination of function and provider-defined tools`
|
|
@@ -700,6 +756,45 @@ function prepareTools({
|
|
|
700
756
|
break;
|
|
701
757
|
}
|
|
702
758
|
});
|
|
759
|
+
if (hasFunctionTools && isGemini3orNewer && googleTools2.length > 0) {
|
|
760
|
+
const functionDeclarations2 = [];
|
|
761
|
+
for (const tool of tools) {
|
|
762
|
+
if (tool.type === "function") {
|
|
763
|
+
functionDeclarations2.push({
|
|
764
|
+
name: tool.name,
|
|
765
|
+
description: (_a = tool.description) != null ? _a : "",
|
|
766
|
+
parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
const combinedToolConfig = {
|
|
771
|
+
functionCallingConfig: { mode: "VALIDATED" },
|
|
772
|
+
includeServerSideToolInvocations: true
|
|
773
|
+
};
|
|
774
|
+
if (toolChoice != null) {
|
|
775
|
+
switch (toolChoice.type) {
|
|
776
|
+
case "auto":
|
|
777
|
+
break;
|
|
778
|
+
case "none":
|
|
779
|
+
combinedToolConfig.functionCallingConfig = { mode: "NONE" };
|
|
780
|
+
break;
|
|
781
|
+
case "required":
|
|
782
|
+
combinedToolConfig.functionCallingConfig = { mode: "ANY" };
|
|
783
|
+
break;
|
|
784
|
+
case "tool":
|
|
785
|
+
combinedToolConfig.functionCallingConfig = {
|
|
786
|
+
mode: "ANY",
|
|
787
|
+
allowedFunctionNames: [toolChoice.toolName]
|
|
788
|
+
};
|
|
789
|
+
break;
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
return {
|
|
793
|
+
tools: [...googleTools2, { functionDeclarations: functionDeclarations2 }],
|
|
794
|
+
toolConfig: combinedToolConfig,
|
|
795
|
+
toolWarnings
|
|
796
|
+
};
|
|
797
|
+
}
|
|
703
798
|
return {
|
|
704
799
|
tools: googleTools2.length > 0 ? googleTools2 : void 0,
|
|
705
800
|
toolConfig: void 0,
|
|
@@ -713,7 +808,7 @@ function prepareTools({
|
|
|
713
808
|
case "function":
|
|
714
809
|
functionDeclarations.push({
|
|
715
810
|
name: tool.name,
|
|
716
|
-
description: (
|
|
811
|
+
description: (_b = tool.description) != null ? _b : "",
|
|
717
812
|
parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
|
|
718
813
|
});
|
|
719
814
|
if (tool.strict === true) {
|
|
@@ -922,14 +1017,15 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
922
1017
|
retrievalConfig: googleOptions.retrievalConfig
|
|
923
1018
|
} : googleToolConfig,
|
|
924
1019
|
cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
|
|
925
|
-
labels: googleOptions == null ? void 0 : googleOptions.labels
|
|
1020
|
+
labels: googleOptions == null ? void 0 : googleOptions.labels,
|
|
1021
|
+
serviceTier: googleOptions == null ? void 0 : googleOptions.serviceTier
|
|
926
1022
|
},
|
|
927
1023
|
warnings: [...warnings, ...toolWarnings],
|
|
928
1024
|
providerOptionsName
|
|
929
1025
|
};
|
|
930
1026
|
}
|
|
931
1027
|
async doGenerate(options) {
|
|
932
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1028
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
933
1029
|
const { args, warnings, providerOptionsName } = await this.getArgs(options);
|
|
934
1030
|
const mergedHeaders = combineHeaders(
|
|
935
1031
|
await resolve(this.config.headers),
|
|
@@ -955,6 +1051,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
955
1051
|
const parts = (_b = (_a = candidate.content) == null ? void 0 : _a.parts) != null ? _b : [];
|
|
956
1052
|
const usageMetadata = response.usageMetadata;
|
|
957
1053
|
let lastCodeExecutionToolCallId;
|
|
1054
|
+
let lastServerToolCallId;
|
|
958
1055
|
for (const part of parts) {
|
|
959
1056
|
if ("executableCode" in part && ((_c = part.executableCode) == null ? void 0 : _c.code)) {
|
|
960
1057
|
const toolCallId = this.config.generateId();
|
|
@@ -1022,12 +1119,56 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1022
1119
|
}
|
|
1023
1120
|
} : void 0
|
|
1024
1121
|
});
|
|
1122
|
+
} else if ("toolCall" in part && part.toolCall) {
|
|
1123
|
+
const toolCallId = (_e = part.toolCall.id) != null ? _e : this.config.generateId();
|
|
1124
|
+
lastServerToolCallId = toolCallId;
|
|
1125
|
+
content.push({
|
|
1126
|
+
type: "tool-call",
|
|
1127
|
+
toolCallId,
|
|
1128
|
+
toolName: `server:${part.toolCall.toolType}`,
|
|
1129
|
+
input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
|
|
1130
|
+
providerExecuted: true,
|
|
1131
|
+
dynamic: true,
|
|
1132
|
+
providerMetadata: part.thoughtSignature ? {
|
|
1133
|
+
[providerOptionsName]: {
|
|
1134
|
+
thoughtSignature: part.thoughtSignature,
|
|
1135
|
+
serverToolCallId: toolCallId,
|
|
1136
|
+
serverToolType: part.toolCall.toolType
|
|
1137
|
+
}
|
|
1138
|
+
} : {
|
|
1139
|
+
[providerOptionsName]: {
|
|
1140
|
+
serverToolCallId: toolCallId,
|
|
1141
|
+
serverToolType: part.toolCall.toolType
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
});
|
|
1145
|
+
} else if ("toolResponse" in part && part.toolResponse) {
|
|
1146
|
+
const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : this.config.generateId();
|
|
1147
|
+
content.push({
|
|
1148
|
+
type: "tool-result",
|
|
1149
|
+
toolCallId: responseToolCallId,
|
|
1150
|
+
toolName: `server:${part.toolResponse.toolType}`,
|
|
1151
|
+
result: (_h = part.toolResponse.response) != null ? _h : {},
|
|
1152
|
+
providerMetadata: part.thoughtSignature ? {
|
|
1153
|
+
[providerOptionsName]: {
|
|
1154
|
+
thoughtSignature: part.thoughtSignature,
|
|
1155
|
+
serverToolCallId: responseToolCallId,
|
|
1156
|
+
serverToolType: part.toolResponse.toolType
|
|
1157
|
+
}
|
|
1158
|
+
} : {
|
|
1159
|
+
[providerOptionsName]: {
|
|
1160
|
+
serverToolCallId: responseToolCallId,
|
|
1161
|
+
serverToolType: part.toolResponse.toolType
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
});
|
|
1165
|
+
lastServerToolCallId = void 0;
|
|
1025
1166
|
}
|
|
1026
1167
|
}
|
|
1027
|
-
const sources = (
|
|
1168
|
+
const sources = (_i = extractSources({
|
|
1028
1169
|
groundingMetadata: candidate.groundingMetadata,
|
|
1029
1170
|
generateId: this.config.generateId
|
|
1030
|
-
})) != null ?
|
|
1171
|
+
})) != null ? _i : [];
|
|
1031
1172
|
for (const source of sources) {
|
|
1032
1173
|
content.push(source);
|
|
1033
1174
|
}
|
|
@@ -1041,18 +1182,19 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1041
1182
|
(part) => part.type === "tool-call" && !part.providerExecuted
|
|
1042
1183
|
)
|
|
1043
1184
|
}),
|
|
1044
|
-
raw: (
|
|
1185
|
+
raw: (_j = candidate.finishReason) != null ? _j : void 0
|
|
1045
1186
|
},
|
|
1046
1187
|
usage: convertGoogleGenerativeAIUsage(usageMetadata),
|
|
1047
1188
|
warnings,
|
|
1048
1189
|
providerMetadata: {
|
|
1049
1190
|
[providerOptionsName]: {
|
|
1050
|
-
promptFeedback: (
|
|
1051
|
-
groundingMetadata: (
|
|
1052
|
-
urlContextMetadata: (
|
|
1053
|
-
safetyRatings: (
|
|
1191
|
+
promptFeedback: (_k = response.promptFeedback) != null ? _k : null,
|
|
1192
|
+
groundingMetadata: (_l = candidate.groundingMetadata) != null ? _l : null,
|
|
1193
|
+
urlContextMetadata: (_m = candidate.urlContextMetadata) != null ? _m : null,
|
|
1194
|
+
safetyRatings: (_n = candidate.safetyRatings) != null ? _n : null,
|
|
1054
1195
|
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
1055
|
-
finishMessage: (
|
|
1196
|
+
finishMessage: (_o = candidate.finishMessage) != null ? _o : null,
|
|
1197
|
+
serviceTier: (_p = response.serviceTier) != null ? _p : null
|
|
1056
1198
|
}
|
|
1057
1199
|
},
|
|
1058
1200
|
request: { body: args },
|
|
@@ -1088,6 +1230,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1088
1230
|
let providerMetadata = void 0;
|
|
1089
1231
|
let lastGroundingMetadata = null;
|
|
1090
1232
|
let lastUrlContextMetadata = null;
|
|
1233
|
+
let serviceTier = null;
|
|
1091
1234
|
const generateId2 = this.config.generateId;
|
|
1092
1235
|
let hasToolCalls = false;
|
|
1093
1236
|
let currentTextBlockId = null;
|
|
@@ -1095,6 +1238,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1095
1238
|
let blockCounter = 0;
|
|
1096
1239
|
const emittedSourceUrls = /* @__PURE__ */ new Set();
|
|
1097
1240
|
let lastCodeExecutionToolCallId;
|
|
1241
|
+
let lastServerToolCallId;
|
|
1098
1242
|
return {
|
|
1099
1243
|
stream: response.pipeThrough(
|
|
1100
1244
|
new TransformStream({
|
|
@@ -1102,7 +1246,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1102
1246
|
controller.enqueue({ type: "stream-start", warnings });
|
|
1103
1247
|
},
|
|
1104
1248
|
transform(chunk, controller) {
|
|
1105
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1249
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1106
1250
|
if (options.includeRawChunks) {
|
|
1107
1251
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
1108
1252
|
}
|
|
@@ -1115,6 +1259,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1115
1259
|
if (usageMetadata != null) {
|
|
1116
1260
|
usage = usageMetadata;
|
|
1117
1261
|
}
|
|
1262
|
+
if (value.serviceTier != null) {
|
|
1263
|
+
serviceTier = value.serviceTier;
|
|
1264
|
+
}
|
|
1118
1265
|
const candidate = (_a = value.candidates) == null ? void 0 : _a[0];
|
|
1119
1266
|
if (candidate == null) {
|
|
1120
1267
|
return;
|
|
@@ -1254,6 +1401,42 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1254
1401
|
data: part.inlineData.data,
|
|
1255
1402
|
providerMetadata: fileMeta
|
|
1256
1403
|
});
|
|
1404
|
+
} else if ("toolCall" in part && part.toolCall) {
|
|
1405
|
+
const toolCallId = (_e = part.toolCall.id) != null ? _e : generateId2();
|
|
1406
|
+
lastServerToolCallId = toolCallId;
|
|
1407
|
+
const serverMeta = {
|
|
1408
|
+
[providerOptionsName]: {
|
|
1409
|
+
...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
|
|
1410
|
+
serverToolCallId: toolCallId,
|
|
1411
|
+
serverToolType: part.toolCall.toolType
|
|
1412
|
+
}
|
|
1413
|
+
};
|
|
1414
|
+
controller.enqueue({
|
|
1415
|
+
type: "tool-call",
|
|
1416
|
+
toolCallId,
|
|
1417
|
+
toolName: `server:${part.toolCall.toolType}`,
|
|
1418
|
+
input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
|
|
1419
|
+
providerExecuted: true,
|
|
1420
|
+
dynamic: true,
|
|
1421
|
+
providerMetadata: serverMeta
|
|
1422
|
+
});
|
|
1423
|
+
} else if ("toolResponse" in part && part.toolResponse) {
|
|
1424
|
+
const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : generateId2();
|
|
1425
|
+
const serverMeta = {
|
|
1426
|
+
[providerOptionsName]: {
|
|
1427
|
+
...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
|
|
1428
|
+
serverToolCallId: responseToolCallId,
|
|
1429
|
+
serverToolType: part.toolResponse.toolType
|
|
1430
|
+
}
|
|
1431
|
+
};
|
|
1432
|
+
controller.enqueue({
|
|
1433
|
+
type: "tool-result",
|
|
1434
|
+
toolCallId: responseToolCallId,
|
|
1435
|
+
toolName: `server:${part.toolResponse.toolType}`,
|
|
1436
|
+
result: (_h = part.toolResponse.response) != null ? _h : {},
|
|
1437
|
+
providerMetadata: serverMeta
|
|
1438
|
+
});
|
|
1439
|
+
lastServerToolCallId = void 0;
|
|
1257
1440
|
}
|
|
1258
1441
|
}
|
|
1259
1442
|
const toolCallDeltas = getToolCallsFromParts({
|
|
@@ -1301,12 +1484,13 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1301
1484
|
};
|
|
1302
1485
|
providerMetadata = {
|
|
1303
1486
|
[providerOptionsName]: {
|
|
1304
|
-
promptFeedback: (
|
|
1487
|
+
promptFeedback: (_i = value.promptFeedback) != null ? _i : null,
|
|
1305
1488
|
groundingMetadata: lastGroundingMetadata,
|
|
1306
1489
|
urlContextMetadata: lastUrlContextMetadata,
|
|
1307
|
-
safetyRatings: (
|
|
1490
|
+
safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null,
|
|
1308
1491
|
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
1309
|
-
finishMessage: (
|
|
1492
|
+
finishMessage: (_k = candidate.finishMessage) != null ? _k : null,
|
|
1493
|
+
serviceTier
|
|
1310
1494
|
}
|
|
1311
1495
|
};
|
|
1312
1496
|
}
|
|
@@ -1520,6 +1704,22 @@ var getContentSchema = () => z3.object({
|
|
|
1520
1704
|
thought: z3.boolean().nullish(),
|
|
1521
1705
|
thoughtSignature: z3.string().nullish()
|
|
1522
1706
|
}),
|
|
1707
|
+
z3.object({
|
|
1708
|
+
toolCall: z3.object({
|
|
1709
|
+
toolType: z3.string(),
|
|
1710
|
+
args: z3.unknown().nullish(),
|
|
1711
|
+
id: z3.string()
|
|
1712
|
+
}),
|
|
1713
|
+
thoughtSignature: z3.string().nullish()
|
|
1714
|
+
}),
|
|
1715
|
+
z3.object({
|
|
1716
|
+
toolResponse: z3.object({
|
|
1717
|
+
toolType: z3.string(),
|
|
1718
|
+
response: z3.unknown().nullish(),
|
|
1719
|
+
id: z3.string()
|
|
1720
|
+
}),
|
|
1721
|
+
thoughtSignature: z3.string().nullish()
|
|
1722
|
+
}),
|
|
1523
1723
|
z3.object({
|
|
1524
1724
|
executableCode: z3.object({
|
|
1525
1725
|
language: z3.string(),
|
|
@@ -1578,7 +1778,8 @@ var responseSchema = lazySchema3(
|
|
|
1578
1778
|
promptFeedback: z3.object({
|
|
1579
1779
|
blockReason: z3.string().nullish(),
|
|
1580
1780
|
safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
|
|
1581
|
-
}).nullish()
|
|
1781
|
+
}).nullish(),
|
|
1782
|
+
serviceTier: z3.string().nullish()
|
|
1582
1783
|
})
|
|
1583
1784
|
)
|
|
1584
1785
|
);
|
|
@@ -1599,7 +1800,8 @@ var chunkSchema = lazySchema3(
|
|
|
1599
1800
|
promptFeedback: z3.object({
|
|
1600
1801
|
blockReason: z3.string().nullish(),
|
|
1601
1802
|
safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
|
|
1602
|
-
}).nullish()
|
|
1803
|
+
}).nullish(),
|
|
1804
|
+
serviceTier: z3.string().nullish()
|
|
1603
1805
|
})
|
|
1604
1806
|
)
|
|
1605
1807
|
);
|