@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/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "3.0.
|
|
10
|
+
var VERSION = true ? "3.0.55" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -511,7 +511,7 @@ function appendLegacyToolResultParts(parts, toolName, outputValue) {
|
|
|
511
511
|
}
|
|
512
512
|
}
|
|
513
513
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
514
|
-
var _a, _b, _c, _d;
|
|
514
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
515
515
|
const systemInstructionParts = [];
|
|
516
516
|
const contents = [];
|
|
517
517
|
let systemMessagesAllowed = true;
|
|
@@ -598,6 +598,18 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
598
598
|
};
|
|
599
599
|
}
|
|
600
600
|
case "tool-call": {
|
|
601
|
+
const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
|
|
602
|
+
const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
|
|
603
|
+
if (serverToolCallId && serverToolType) {
|
|
604
|
+
return {
|
|
605
|
+
toolCall: {
|
|
606
|
+
toolType: serverToolType,
|
|
607
|
+
args: typeof part.input === "string" ? JSON.parse(part.input) : part.input,
|
|
608
|
+
id: serverToolCallId
|
|
609
|
+
},
|
|
610
|
+
thoughtSignature
|
|
611
|
+
};
|
|
612
|
+
}
|
|
601
613
|
return {
|
|
602
614
|
functionCall: {
|
|
603
615
|
name: part.toolName,
|
|
@@ -606,6 +618,21 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
606
618
|
thoughtSignature
|
|
607
619
|
};
|
|
608
620
|
}
|
|
621
|
+
case "tool-result": {
|
|
622
|
+
const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
|
|
623
|
+
const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
|
|
624
|
+
if (serverToolCallId && serverToolType) {
|
|
625
|
+
return {
|
|
626
|
+
toolResponse: {
|
|
627
|
+
toolType: serverToolType,
|
|
628
|
+
response: part.output.type === "json" ? part.output.value : {},
|
|
629
|
+
id: serverToolCallId
|
|
630
|
+
},
|
|
631
|
+
thoughtSignature
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
return void 0;
|
|
635
|
+
}
|
|
609
636
|
}
|
|
610
637
|
}).filter((part) => part !== void 0)
|
|
611
638
|
});
|
|
@@ -618,6 +645,26 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
618
645
|
if (part.type === "tool-approval-response") {
|
|
619
646
|
continue;
|
|
620
647
|
}
|
|
648
|
+
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;
|
|
649
|
+
const serverToolCallId = (partProviderOpts == null ? void 0 : partProviderOpts.serverToolCallId) != null ? String(partProviderOpts.serverToolCallId) : void 0;
|
|
650
|
+
const serverToolType = (partProviderOpts == null ? void 0 : partProviderOpts.serverToolType) != null ? String(partProviderOpts.serverToolType) : void 0;
|
|
651
|
+
if (serverToolCallId && serverToolType) {
|
|
652
|
+
const serverThoughtSignature = (partProviderOpts == null ? void 0 : partProviderOpts.thoughtSignature) != null ? String(partProviderOpts.thoughtSignature) : void 0;
|
|
653
|
+
if (contents.length > 0) {
|
|
654
|
+
const lastContent = contents[contents.length - 1];
|
|
655
|
+
if (lastContent.role === "model") {
|
|
656
|
+
lastContent.parts.push({
|
|
657
|
+
toolResponse: {
|
|
658
|
+
toolType: serverToolType,
|
|
659
|
+
response: part.output.type === "json" ? part.output.value : {},
|
|
660
|
+
id: serverToolCallId
|
|
661
|
+
},
|
|
662
|
+
thoughtSignature: serverThoughtSignature
|
|
663
|
+
});
|
|
664
|
+
continue;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
621
668
|
const output = part.output;
|
|
622
669
|
if (output.type === "content") {
|
|
623
670
|
if (supportsFunctionResponseParts) {
|
|
@@ -631,7 +678,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
631
678
|
name: part.toolName,
|
|
632
679
|
response: {
|
|
633
680
|
name: part.toolName,
|
|
634
|
-
content: output.type === "execution-denied" ? (
|
|
681
|
+
content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool execution denied." : output.value
|
|
635
682
|
}
|
|
636
683
|
}
|
|
637
684
|
});
|
|
@@ -777,7 +824,15 @@ var googleLanguageModelOptions = lazySchema4(
|
|
|
777
824
|
latitude: z4.number(),
|
|
778
825
|
longitude: z4.number()
|
|
779
826
|
}).optional()
|
|
780
|
-
}).optional()
|
|
827
|
+
}).optional(),
|
|
828
|
+
/**
|
|
829
|
+
* Optional. The service tier to use for the request.
|
|
830
|
+
*/
|
|
831
|
+
serviceTier: z4.enum([
|
|
832
|
+
"SERVICE_TIER_STANDARD",
|
|
833
|
+
"SERVICE_TIER_FLEX",
|
|
834
|
+
"SERVICE_TIER_PRIORITY"
|
|
835
|
+
]).optional()
|
|
781
836
|
})
|
|
782
837
|
)
|
|
783
838
|
);
|
|
@@ -791,7 +846,7 @@ function prepareTools({
|
|
|
791
846
|
toolChoice,
|
|
792
847
|
modelId
|
|
793
848
|
}) {
|
|
794
|
-
var _a;
|
|
849
|
+
var _a, _b;
|
|
795
850
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
796
851
|
const toolWarnings = [];
|
|
797
852
|
const isLatest = [
|
|
@@ -800,13 +855,14 @@ function prepareTools({
|
|
|
800
855
|
"gemini-pro-latest"
|
|
801
856
|
].some((id) => id === modelId);
|
|
802
857
|
const isGemini2orNewer = modelId.includes("gemini-2") || modelId.includes("gemini-3") || modelId.includes("nano-banana") || isLatest;
|
|
858
|
+
const isGemini3orNewer = modelId.includes("gemini-3");
|
|
803
859
|
const supportsFileSearch = modelId.includes("gemini-2.5") || modelId.includes("gemini-3");
|
|
804
860
|
if (tools == null) {
|
|
805
861
|
return { tools: void 0, toolConfig: void 0, toolWarnings };
|
|
806
862
|
}
|
|
807
863
|
const hasFunctionTools = tools.some((tool) => tool.type === "function");
|
|
808
864
|
const hasProviderTools = tools.some((tool) => tool.type === "provider");
|
|
809
|
-
if (hasFunctionTools && hasProviderTools) {
|
|
865
|
+
if (hasFunctionTools && hasProviderTools && !isGemini3orNewer) {
|
|
810
866
|
toolWarnings.push({
|
|
811
867
|
type: "unsupported",
|
|
812
868
|
feature: `combination of function and provider-defined tools`
|
|
@@ -911,6 +967,45 @@ function prepareTools({
|
|
|
911
967
|
break;
|
|
912
968
|
}
|
|
913
969
|
});
|
|
970
|
+
if (hasFunctionTools && isGemini3orNewer && googleTools2.length > 0) {
|
|
971
|
+
const functionDeclarations2 = [];
|
|
972
|
+
for (const tool of tools) {
|
|
973
|
+
if (tool.type === "function") {
|
|
974
|
+
functionDeclarations2.push({
|
|
975
|
+
name: tool.name,
|
|
976
|
+
description: (_a = tool.description) != null ? _a : "",
|
|
977
|
+
parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
const combinedToolConfig = {
|
|
982
|
+
functionCallingConfig: { mode: "VALIDATED" },
|
|
983
|
+
includeServerSideToolInvocations: true
|
|
984
|
+
};
|
|
985
|
+
if (toolChoice != null) {
|
|
986
|
+
switch (toolChoice.type) {
|
|
987
|
+
case "auto":
|
|
988
|
+
break;
|
|
989
|
+
case "none":
|
|
990
|
+
combinedToolConfig.functionCallingConfig = { mode: "NONE" };
|
|
991
|
+
break;
|
|
992
|
+
case "required":
|
|
993
|
+
combinedToolConfig.functionCallingConfig = { mode: "ANY" };
|
|
994
|
+
break;
|
|
995
|
+
case "tool":
|
|
996
|
+
combinedToolConfig.functionCallingConfig = {
|
|
997
|
+
mode: "ANY",
|
|
998
|
+
allowedFunctionNames: [toolChoice.toolName]
|
|
999
|
+
};
|
|
1000
|
+
break;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
return {
|
|
1004
|
+
tools: [...googleTools2, { functionDeclarations: functionDeclarations2 }],
|
|
1005
|
+
toolConfig: combinedToolConfig,
|
|
1006
|
+
toolWarnings
|
|
1007
|
+
};
|
|
1008
|
+
}
|
|
914
1009
|
return {
|
|
915
1010
|
tools: googleTools2.length > 0 ? googleTools2 : void 0,
|
|
916
1011
|
toolConfig: void 0,
|
|
@@ -924,7 +1019,7 @@ function prepareTools({
|
|
|
924
1019
|
case "function":
|
|
925
1020
|
functionDeclarations.push({
|
|
926
1021
|
name: tool.name,
|
|
927
|
-
description: (
|
|
1022
|
+
description: (_b = tool.description) != null ? _b : "",
|
|
928
1023
|
parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
|
|
929
1024
|
});
|
|
930
1025
|
if (tool.strict === true) {
|
|
@@ -1133,14 +1228,15 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1133
1228
|
retrievalConfig: googleOptions.retrievalConfig
|
|
1134
1229
|
} : googleToolConfig,
|
|
1135
1230
|
cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
|
|
1136
|
-
labels: googleOptions == null ? void 0 : googleOptions.labels
|
|
1231
|
+
labels: googleOptions == null ? void 0 : googleOptions.labels,
|
|
1232
|
+
serviceTier: googleOptions == null ? void 0 : googleOptions.serviceTier
|
|
1137
1233
|
},
|
|
1138
1234
|
warnings: [...warnings, ...toolWarnings],
|
|
1139
1235
|
providerOptionsName
|
|
1140
1236
|
};
|
|
1141
1237
|
}
|
|
1142
1238
|
async doGenerate(options) {
|
|
1143
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1239
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
1144
1240
|
const { args, warnings, providerOptionsName } = await this.getArgs(options);
|
|
1145
1241
|
const mergedHeaders = combineHeaders2(
|
|
1146
1242
|
await resolve2(this.config.headers),
|
|
@@ -1166,6 +1262,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1166
1262
|
const parts = (_b = (_a = candidate.content) == null ? void 0 : _a.parts) != null ? _b : [];
|
|
1167
1263
|
const usageMetadata = response.usageMetadata;
|
|
1168
1264
|
let lastCodeExecutionToolCallId;
|
|
1265
|
+
let lastServerToolCallId;
|
|
1169
1266
|
for (const part of parts) {
|
|
1170
1267
|
if ("executableCode" in part && ((_c = part.executableCode) == null ? void 0 : _c.code)) {
|
|
1171
1268
|
const toolCallId = this.config.generateId();
|
|
@@ -1233,12 +1330,56 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1233
1330
|
}
|
|
1234
1331
|
} : void 0
|
|
1235
1332
|
});
|
|
1333
|
+
} else if ("toolCall" in part && part.toolCall) {
|
|
1334
|
+
const toolCallId = (_e = part.toolCall.id) != null ? _e : this.config.generateId();
|
|
1335
|
+
lastServerToolCallId = toolCallId;
|
|
1336
|
+
content.push({
|
|
1337
|
+
type: "tool-call",
|
|
1338
|
+
toolCallId,
|
|
1339
|
+
toolName: `server:${part.toolCall.toolType}`,
|
|
1340
|
+
input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
|
|
1341
|
+
providerExecuted: true,
|
|
1342
|
+
dynamic: true,
|
|
1343
|
+
providerMetadata: part.thoughtSignature ? {
|
|
1344
|
+
[providerOptionsName]: {
|
|
1345
|
+
thoughtSignature: part.thoughtSignature,
|
|
1346
|
+
serverToolCallId: toolCallId,
|
|
1347
|
+
serverToolType: part.toolCall.toolType
|
|
1348
|
+
}
|
|
1349
|
+
} : {
|
|
1350
|
+
[providerOptionsName]: {
|
|
1351
|
+
serverToolCallId: toolCallId,
|
|
1352
|
+
serverToolType: part.toolCall.toolType
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
});
|
|
1356
|
+
} else if ("toolResponse" in part && part.toolResponse) {
|
|
1357
|
+
const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : this.config.generateId();
|
|
1358
|
+
content.push({
|
|
1359
|
+
type: "tool-result",
|
|
1360
|
+
toolCallId: responseToolCallId,
|
|
1361
|
+
toolName: `server:${part.toolResponse.toolType}`,
|
|
1362
|
+
result: (_h = part.toolResponse.response) != null ? _h : {},
|
|
1363
|
+
providerMetadata: part.thoughtSignature ? {
|
|
1364
|
+
[providerOptionsName]: {
|
|
1365
|
+
thoughtSignature: part.thoughtSignature,
|
|
1366
|
+
serverToolCallId: responseToolCallId,
|
|
1367
|
+
serverToolType: part.toolResponse.toolType
|
|
1368
|
+
}
|
|
1369
|
+
} : {
|
|
1370
|
+
[providerOptionsName]: {
|
|
1371
|
+
serverToolCallId: responseToolCallId,
|
|
1372
|
+
serverToolType: part.toolResponse.toolType
|
|
1373
|
+
}
|
|
1374
|
+
}
|
|
1375
|
+
});
|
|
1376
|
+
lastServerToolCallId = void 0;
|
|
1236
1377
|
}
|
|
1237
1378
|
}
|
|
1238
|
-
const sources = (
|
|
1379
|
+
const sources = (_i = extractSources({
|
|
1239
1380
|
groundingMetadata: candidate.groundingMetadata,
|
|
1240
1381
|
generateId: this.config.generateId
|
|
1241
|
-
})) != null ?
|
|
1382
|
+
})) != null ? _i : [];
|
|
1242
1383
|
for (const source of sources) {
|
|
1243
1384
|
content.push(source);
|
|
1244
1385
|
}
|
|
@@ -1252,18 +1393,19 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1252
1393
|
(part) => part.type === "tool-call" && !part.providerExecuted
|
|
1253
1394
|
)
|
|
1254
1395
|
}),
|
|
1255
|
-
raw: (
|
|
1396
|
+
raw: (_j = candidate.finishReason) != null ? _j : void 0
|
|
1256
1397
|
},
|
|
1257
1398
|
usage: convertGoogleGenerativeAIUsage(usageMetadata),
|
|
1258
1399
|
warnings,
|
|
1259
1400
|
providerMetadata: {
|
|
1260
1401
|
[providerOptionsName]: {
|
|
1261
|
-
promptFeedback: (
|
|
1262
|
-
groundingMetadata: (
|
|
1263
|
-
urlContextMetadata: (
|
|
1264
|
-
safetyRatings: (
|
|
1402
|
+
promptFeedback: (_k = response.promptFeedback) != null ? _k : null,
|
|
1403
|
+
groundingMetadata: (_l = candidate.groundingMetadata) != null ? _l : null,
|
|
1404
|
+
urlContextMetadata: (_m = candidate.urlContextMetadata) != null ? _m : null,
|
|
1405
|
+
safetyRatings: (_n = candidate.safetyRatings) != null ? _n : null,
|
|
1265
1406
|
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
1266
|
-
finishMessage: (
|
|
1407
|
+
finishMessage: (_o = candidate.finishMessage) != null ? _o : null,
|
|
1408
|
+
serviceTier: (_p = response.serviceTier) != null ? _p : null
|
|
1267
1409
|
}
|
|
1268
1410
|
},
|
|
1269
1411
|
request: { body: args },
|
|
@@ -1299,6 +1441,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1299
1441
|
let providerMetadata = void 0;
|
|
1300
1442
|
let lastGroundingMetadata = null;
|
|
1301
1443
|
let lastUrlContextMetadata = null;
|
|
1444
|
+
let serviceTier = null;
|
|
1302
1445
|
const generateId3 = this.config.generateId;
|
|
1303
1446
|
let hasToolCalls = false;
|
|
1304
1447
|
let currentTextBlockId = null;
|
|
@@ -1306,6 +1449,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1306
1449
|
let blockCounter = 0;
|
|
1307
1450
|
const emittedSourceUrls = /* @__PURE__ */ new Set();
|
|
1308
1451
|
let lastCodeExecutionToolCallId;
|
|
1452
|
+
let lastServerToolCallId;
|
|
1309
1453
|
return {
|
|
1310
1454
|
stream: response.pipeThrough(
|
|
1311
1455
|
new TransformStream({
|
|
@@ -1313,7 +1457,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1313
1457
|
controller.enqueue({ type: "stream-start", warnings });
|
|
1314
1458
|
},
|
|
1315
1459
|
transform(chunk, controller) {
|
|
1316
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1460
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1317
1461
|
if (options.includeRawChunks) {
|
|
1318
1462
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
1319
1463
|
}
|
|
@@ -1326,6 +1470,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1326
1470
|
if (usageMetadata != null) {
|
|
1327
1471
|
usage = usageMetadata;
|
|
1328
1472
|
}
|
|
1473
|
+
if (value.serviceTier != null) {
|
|
1474
|
+
serviceTier = value.serviceTier;
|
|
1475
|
+
}
|
|
1329
1476
|
const candidate = (_a = value.candidates) == null ? void 0 : _a[0];
|
|
1330
1477
|
if (candidate == null) {
|
|
1331
1478
|
return;
|
|
@@ -1465,6 +1612,42 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1465
1612
|
data: part.inlineData.data,
|
|
1466
1613
|
providerMetadata: fileMeta
|
|
1467
1614
|
});
|
|
1615
|
+
} else if ("toolCall" in part && part.toolCall) {
|
|
1616
|
+
const toolCallId = (_e = part.toolCall.id) != null ? _e : generateId3();
|
|
1617
|
+
lastServerToolCallId = toolCallId;
|
|
1618
|
+
const serverMeta = {
|
|
1619
|
+
[providerOptionsName]: {
|
|
1620
|
+
...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
|
|
1621
|
+
serverToolCallId: toolCallId,
|
|
1622
|
+
serverToolType: part.toolCall.toolType
|
|
1623
|
+
}
|
|
1624
|
+
};
|
|
1625
|
+
controller.enqueue({
|
|
1626
|
+
type: "tool-call",
|
|
1627
|
+
toolCallId,
|
|
1628
|
+
toolName: `server:${part.toolCall.toolType}`,
|
|
1629
|
+
input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
|
|
1630
|
+
providerExecuted: true,
|
|
1631
|
+
dynamic: true,
|
|
1632
|
+
providerMetadata: serverMeta
|
|
1633
|
+
});
|
|
1634
|
+
} else if ("toolResponse" in part && part.toolResponse) {
|
|
1635
|
+
const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : generateId3();
|
|
1636
|
+
const serverMeta = {
|
|
1637
|
+
[providerOptionsName]: {
|
|
1638
|
+
...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
|
|
1639
|
+
serverToolCallId: responseToolCallId,
|
|
1640
|
+
serverToolType: part.toolResponse.toolType
|
|
1641
|
+
}
|
|
1642
|
+
};
|
|
1643
|
+
controller.enqueue({
|
|
1644
|
+
type: "tool-result",
|
|
1645
|
+
toolCallId: responseToolCallId,
|
|
1646
|
+
toolName: `server:${part.toolResponse.toolType}`,
|
|
1647
|
+
result: (_h = part.toolResponse.response) != null ? _h : {},
|
|
1648
|
+
providerMetadata: serverMeta
|
|
1649
|
+
});
|
|
1650
|
+
lastServerToolCallId = void 0;
|
|
1468
1651
|
}
|
|
1469
1652
|
}
|
|
1470
1653
|
const toolCallDeltas = getToolCallsFromParts({
|
|
@@ -1512,12 +1695,13 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1512
1695
|
};
|
|
1513
1696
|
providerMetadata = {
|
|
1514
1697
|
[providerOptionsName]: {
|
|
1515
|
-
promptFeedback: (
|
|
1698
|
+
promptFeedback: (_i = value.promptFeedback) != null ? _i : null,
|
|
1516
1699
|
groundingMetadata: lastGroundingMetadata,
|
|
1517
1700
|
urlContextMetadata: lastUrlContextMetadata,
|
|
1518
|
-
safetyRatings: (
|
|
1701
|
+
safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null,
|
|
1519
1702
|
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
1520
|
-
finishMessage: (
|
|
1703
|
+
finishMessage: (_k = candidate.finishMessage) != null ? _k : null,
|
|
1704
|
+
serviceTier
|
|
1521
1705
|
}
|
|
1522
1706
|
};
|
|
1523
1707
|
}
|
|
@@ -1731,6 +1915,22 @@ var getContentSchema = () => z5.object({
|
|
|
1731
1915
|
thought: z5.boolean().nullish(),
|
|
1732
1916
|
thoughtSignature: z5.string().nullish()
|
|
1733
1917
|
}),
|
|
1918
|
+
z5.object({
|
|
1919
|
+
toolCall: z5.object({
|
|
1920
|
+
toolType: z5.string(),
|
|
1921
|
+
args: z5.unknown().nullish(),
|
|
1922
|
+
id: z5.string()
|
|
1923
|
+
}),
|
|
1924
|
+
thoughtSignature: z5.string().nullish()
|
|
1925
|
+
}),
|
|
1926
|
+
z5.object({
|
|
1927
|
+
toolResponse: z5.object({
|
|
1928
|
+
toolType: z5.string(),
|
|
1929
|
+
response: z5.unknown().nullish(),
|
|
1930
|
+
id: z5.string()
|
|
1931
|
+
}),
|
|
1932
|
+
thoughtSignature: z5.string().nullish()
|
|
1933
|
+
}),
|
|
1734
1934
|
z5.object({
|
|
1735
1935
|
executableCode: z5.object({
|
|
1736
1936
|
language: z5.string(),
|
|
@@ -1789,7 +1989,8 @@ var responseSchema = lazySchema5(
|
|
|
1789
1989
|
promptFeedback: z5.object({
|
|
1790
1990
|
blockReason: z5.string().nullish(),
|
|
1791
1991
|
safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
|
|
1792
|
-
}).nullish()
|
|
1992
|
+
}).nullish(),
|
|
1993
|
+
serviceTier: z5.string().nullish()
|
|
1793
1994
|
})
|
|
1794
1995
|
)
|
|
1795
1996
|
);
|
|
@@ -1810,7 +2011,8 @@ var chunkSchema = lazySchema5(
|
|
|
1810
2011
|
promptFeedback: z5.object({
|
|
1811
2012
|
blockReason: z5.string().nullish(),
|
|
1812
2013
|
safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
|
|
1813
|
-
}).nullish()
|
|
2014
|
+
}).nullish(),
|
|
2015
|
+
serviceTier: z5.string().nullish()
|
|
1814
2016
|
})
|
|
1815
2017
|
)
|
|
1816
2018
|
);
|