@ai-sdk/google 4.0.0-beta.17 → 4.0.0-beta.19
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 +1 -1
- 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 ? "4.0.0-beta.
|
|
10
|
+
var VERSION = true ? "4.0.0-beta.19" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -514,7 +514,7 @@ function appendLegacyToolResultParts(parts, toolName, outputValue) {
|
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
516
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
517
|
-
var _a, _b, _c, _d;
|
|
517
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
518
518
|
const systemInstructionParts = [];
|
|
519
519
|
const contents = [];
|
|
520
520
|
let systemMessagesAllowed = true;
|
|
@@ -616,6 +616,18 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
616
616
|
};
|
|
617
617
|
}
|
|
618
618
|
case "tool-call": {
|
|
619
|
+
const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
|
|
620
|
+
const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
|
|
621
|
+
if (serverToolCallId && serverToolType) {
|
|
622
|
+
return {
|
|
623
|
+
toolCall: {
|
|
624
|
+
toolType: serverToolType,
|
|
625
|
+
args: typeof part.input === "string" ? JSON.parse(part.input) : part.input,
|
|
626
|
+
id: serverToolCallId
|
|
627
|
+
},
|
|
628
|
+
thoughtSignature
|
|
629
|
+
};
|
|
630
|
+
}
|
|
619
631
|
return {
|
|
620
632
|
functionCall: {
|
|
621
633
|
name: part.toolName,
|
|
@@ -624,6 +636,21 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
624
636
|
thoughtSignature
|
|
625
637
|
};
|
|
626
638
|
}
|
|
639
|
+
case "tool-result": {
|
|
640
|
+
const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
|
|
641
|
+
const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
|
|
642
|
+
if (serverToolCallId && serverToolType) {
|
|
643
|
+
return {
|
|
644
|
+
toolResponse: {
|
|
645
|
+
toolType: serverToolType,
|
|
646
|
+
response: part.output.type === "json" ? part.output.value : {},
|
|
647
|
+
id: serverToolCallId
|
|
648
|
+
},
|
|
649
|
+
thoughtSignature
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
return void 0;
|
|
653
|
+
}
|
|
627
654
|
}
|
|
628
655
|
}).filter((part) => part !== void 0)
|
|
629
656
|
});
|
|
@@ -636,6 +663,26 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
636
663
|
if (part.type === "tool-approval-response") {
|
|
637
664
|
continue;
|
|
638
665
|
}
|
|
666
|
+
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;
|
|
667
|
+
const serverToolCallId = (partProviderOpts == null ? void 0 : partProviderOpts.serverToolCallId) != null ? String(partProviderOpts.serverToolCallId) : void 0;
|
|
668
|
+
const serverToolType = (partProviderOpts == null ? void 0 : partProviderOpts.serverToolType) != null ? String(partProviderOpts.serverToolType) : void 0;
|
|
669
|
+
if (serverToolCallId && serverToolType) {
|
|
670
|
+
const serverThoughtSignature = (partProviderOpts == null ? void 0 : partProviderOpts.thoughtSignature) != null ? String(partProviderOpts.thoughtSignature) : void 0;
|
|
671
|
+
if (contents.length > 0) {
|
|
672
|
+
const lastContent = contents[contents.length - 1];
|
|
673
|
+
if (lastContent.role === "model") {
|
|
674
|
+
lastContent.parts.push({
|
|
675
|
+
toolResponse: {
|
|
676
|
+
toolType: serverToolType,
|
|
677
|
+
response: part.output.type === "json" ? part.output.value : {},
|
|
678
|
+
id: serverToolCallId
|
|
679
|
+
},
|
|
680
|
+
thoughtSignature: serverThoughtSignature
|
|
681
|
+
});
|
|
682
|
+
continue;
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
639
686
|
const output = part.output;
|
|
640
687
|
if (output.type === "content") {
|
|
641
688
|
if (supportsFunctionResponseParts) {
|
|
@@ -649,7 +696,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
649
696
|
name: part.toolName,
|
|
650
697
|
response: {
|
|
651
698
|
name: part.toolName,
|
|
652
|
-
content: output.type === "execution-denied" ? (
|
|
699
|
+
content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool execution denied." : output.value
|
|
653
700
|
}
|
|
654
701
|
}
|
|
655
702
|
});
|
|
@@ -795,7 +842,15 @@ var googleLanguageModelOptions = lazySchema4(
|
|
|
795
842
|
latitude: z4.number(),
|
|
796
843
|
longitude: z4.number()
|
|
797
844
|
}).optional()
|
|
798
|
-
}).optional()
|
|
845
|
+
}).optional(),
|
|
846
|
+
/**
|
|
847
|
+
* Optional. The service tier to use for the request.
|
|
848
|
+
*/
|
|
849
|
+
serviceTier: z4.enum([
|
|
850
|
+
"SERVICE_TIER_STANDARD",
|
|
851
|
+
"SERVICE_TIER_FLEX",
|
|
852
|
+
"SERVICE_TIER_PRIORITY"
|
|
853
|
+
]).optional()
|
|
799
854
|
})
|
|
800
855
|
)
|
|
801
856
|
);
|
|
@@ -809,7 +864,7 @@ function prepareTools({
|
|
|
809
864
|
toolChoice,
|
|
810
865
|
modelId
|
|
811
866
|
}) {
|
|
812
|
-
var _a;
|
|
867
|
+
var _a, _b;
|
|
813
868
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
814
869
|
const toolWarnings = [];
|
|
815
870
|
const isLatest = [
|
|
@@ -818,13 +873,14 @@ function prepareTools({
|
|
|
818
873
|
"gemini-pro-latest"
|
|
819
874
|
].some((id) => id === modelId);
|
|
820
875
|
const isGemini2orNewer = modelId.includes("gemini-2") || modelId.includes("gemini-3") || modelId.includes("nano-banana") || isLatest;
|
|
876
|
+
const isGemini3orNewer = modelId.includes("gemini-3");
|
|
821
877
|
const supportsFileSearch = modelId.includes("gemini-2.5") || modelId.includes("gemini-3");
|
|
822
878
|
if (tools == null) {
|
|
823
879
|
return { tools: void 0, toolConfig: void 0, toolWarnings };
|
|
824
880
|
}
|
|
825
881
|
const hasFunctionTools = tools.some((tool) => tool.type === "function");
|
|
826
882
|
const hasProviderTools = tools.some((tool) => tool.type === "provider");
|
|
827
|
-
if (hasFunctionTools && hasProviderTools) {
|
|
883
|
+
if (hasFunctionTools && hasProviderTools && !isGemini3orNewer) {
|
|
828
884
|
toolWarnings.push({
|
|
829
885
|
type: "unsupported",
|
|
830
886
|
feature: `combination of function and provider-defined tools`
|
|
@@ -929,6 +985,45 @@ function prepareTools({
|
|
|
929
985
|
break;
|
|
930
986
|
}
|
|
931
987
|
});
|
|
988
|
+
if (hasFunctionTools && isGemini3orNewer && googleTools2.length > 0) {
|
|
989
|
+
const functionDeclarations2 = [];
|
|
990
|
+
for (const tool of tools) {
|
|
991
|
+
if (tool.type === "function") {
|
|
992
|
+
functionDeclarations2.push({
|
|
993
|
+
name: tool.name,
|
|
994
|
+
description: (_a = tool.description) != null ? _a : "",
|
|
995
|
+
parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
|
|
996
|
+
});
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
const combinedToolConfig = {
|
|
1000
|
+
functionCallingConfig: { mode: "VALIDATED" },
|
|
1001
|
+
includeServerSideToolInvocations: true
|
|
1002
|
+
};
|
|
1003
|
+
if (toolChoice != null) {
|
|
1004
|
+
switch (toolChoice.type) {
|
|
1005
|
+
case "auto":
|
|
1006
|
+
break;
|
|
1007
|
+
case "none":
|
|
1008
|
+
combinedToolConfig.functionCallingConfig = { mode: "NONE" };
|
|
1009
|
+
break;
|
|
1010
|
+
case "required":
|
|
1011
|
+
combinedToolConfig.functionCallingConfig = { mode: "ANY" };
|
|
1012
|
+
break;
|
|
1013
|
+
case "tool":
|
|
1014
|
+
combinedToolConfig.functionCallingConfig = {
|
|
1015
|
+
mode: "ANY",
|
|
1016
|
+
allowedFunctionNames: [toolChoice.toolName]
|
|
1017
|
+
};
|
|
1018
|
+
break;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
return {
|
|
1022
|
+
tools: [...googleTools2, { functionDeclarations: functionDeclarations2 }],
|
|
1023
|
+
toolConfig: combinedToolConfig,
|
|
1024
|
+
toolWarnings
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
932
1027
|
return {
|
|
933
1028
|
tools: googleTools2.length > 0 ? googleTools2 : void 0,
|
|
934
1029
|
toolConfig: void 0,
|
|
@@ -942,7 +1037,7 @@ function prepareTools({
|
|
|
942
1037
|
case "function":
|
|
943
1038
|
functionDeclarations.push({
|
|
944
1039
|
name: tool.name,
|
|
945
|
-
description: (
|
|
1040
|
+
description: (_b = tool.description) != null ? _b : "",
|
|
946
1041
|
parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
|
|
947
1042
|
});
|
|
948
1043
|
if (tool.strict === true) {
|
|
@@ -1158,14 +1253,15 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1158
1253
|
retrievalConfig: googleOptions.retrievalConfig
|
|
1159
1254
|
} : googleToolConfig,
|
|
1160
1255
|
cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
|
|
1161
|
-
labels: googleOptions == null ? void 0 : googleOptions.labels
|
|
1256
|
+
labels: googleOptions == null ? void 0 : googleOptions.labels,
|
|
1257
|
+
serviceTier: googleOptions == null ? void 0 : googleOptions.serviceTier
|
|
1162
1258
|
},
|
|
1163
1259
|
warnings: [...warnings, ...toolWarnings],
|
|
1164
1260
|
providerOptionsName
|
|
1165
1261
|
};
|
|
1166
1262
|
}
|
|
1167
1263
|
async doGenerate(options) {
|
|
1168
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1264
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
1169
1265
|
const { args, warnings, providerOptionsName } = await this.getArgs(options);
|
|
1170
1266
|
const mergedHeaders = combineHeaders2(
|
|
1171
1267
|
await resolve2(this.config.headers),
|
|
@@ -1191,6 +1287,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1191
1287
|
const parts = (_b = (_a = candidate.content) == null ? void 0 : _a.parts) != null ? _b : [];
|
|
1192
1288
|
const usageMetadata = response.usageMetadata;
|
|
1193
1289
|
let lastCodeExecutionToolCallId;
|
|
1290
|
+
let lastServerToolCallId;
|
|
1194
1291
|
for (const part of parts) {
|
|
1195
1292
|
if ("executableCode" in part && ((_c = part.executableCode) == null ? void 0 : _c.code)) {
|
|
1196
1293
|
const toolCallId = this.config.generateId();
|
|
@@ -1257,12 +1354,56 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1257
1354
|
}
|
|
1258
1355
|
} : void 0
|
|
1259
1356
|
});
|
|
1357
|
+
} else if ("toolCall" in part && part.toolCall) {
|
|
1358
|
+
const toolCallId = (_e = part.toolCall.id) != null ? _e : this.config.generateId();
|
|
1359
|
+
lastServerToolCallId = toolCallId;
|
|
1360
|
+
content.push({
|
|
1361
|
+
type: "tool-call",
|
|
1362
|
+
toolCallId,
|
|
1363
|
+
toolName: `server:${part.toolCall.toolType}`,
|
|
1364
|
+
input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
|
|
1365
|
+
providerExecuted: true,
|
|
1366
|
+
dynamic: true,
|
|
1367
|
+
providerMetadata: part.thoughtSignature ? {
|
|
1368
|
+
[providerOptionsName]: {
|
|
1369
|
+
thoughtSignature: part.thoughtSignature,
|
|
1370
|
+
serverToolCallId: toolCallId,
|
|
1371
|
+
serverToolType: part.toolCall.toolType
|
|
1372
|
+
}
|
|
1373
|
+
} : {
|
|
1374
|
+
[providerOptionsName]: {
|
|
1375
|
+
serverToolCallId: toolCallId,
|
|
1376
|
+
serverToolType: part.toolCall.toolType
|
|
1377
|
+
}
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1380
|
+
} else if ("toolResponse" in part && part.toolResponse) {
|
|
1381
|
+
const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : this.config.generateId();
|
|
1382
|
+
content.push({
|
|
1383
|
+
type: "tool-result",
|
|
1384
|
+
toolCallId: responseToolCallId,
|
|
1385
|
+
toolName: `server:${part.toolResponse.toolType}`,
|
|
1386
|
+
result: (_h = part.toolResponse.response) != null ? _h : {},
|
|
1387
|
+
providerMetadata: part.thoughtSignature ? {
|
|
1388
|
+
[providerOptionsName]: {
|
|
1389
|
+
thoughtSignature: part.thoughtSignature,
|
|
1390
|
+
serverToolCallId: responseToolCallId,
|
|
1391
|
+
serverToolType: part.toolResponse.toolType
|
|
1392
|
+
}
|
|
1393
|
+
} : {
|
|
1394
|
+
[providerOptionsName]: {
|
|
1395
|
+
serverToolCallId: responseToolCallId,
|
|
1396
|
+
serverToolType: part.toolResponse.toolType
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
lastServerToolCallId = void 0;
|
|
1260
1401
|
}
|
|
1261
1402
|
}
|
|
1262
|
-
const sources = (
|
|
1403
|
+
const sources = (_i = extractSources({
|
|
1263
1404
|
groundingMetadata: candidate.groundingMetadata,
|
|
1264
1405
|
generateId: this.config.generateId
|
|
1265
|
-
})) != null ?
|
|
1406
|
+
})) != null ? _i : [];
|
|
1266
1407
|
for (const source of sources) {
|
|
1267
1408
|
content.push(source);
|
|
1268
1409
|
}
|
|
@@ -1276,18 +1417,19 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1276
1417
|
(part) => part.type === "tool-call" && !part.providerExecuted
|
|
1277
1418
|
)
|
|
1278
1419
|
}),
|
|
1279
|
-
raw: (
|
|
1420
|
+
raw: (_j = candidate.finishReason) != null ? _j : void 0
|
|
1280
1421
|
},
|
|
1281
1422
|
usage: convertGoogleGenerativeAIUsage(usageMetadata),
|
|
1282
1423
|
warnings,
|
|
1283
1424
|
providerMetadata: {
|
|
1284
1425
|
[providerOptionsName]: {
|
|
1285
|
-
promptFeedback: (
|
|
1286
|
-
groundingMetadata: (
|
|
1287
|
-
urlContextMetadata: (
|
|
1288
|
-
safetyRatings: (
|
|
1426
|
+
promptFeedback: (_k = response.promptFeedback) != null ? _k : null,
|
|
1427
|
+
groundingMetadata: (_l = candidate.groundingMetadata) != null ? _l : null,
|
|
1428
|
+
urlContextMetadata: (_m = candidate.urlContextMetadata) != null ? _m : null,
|
|
1429
|
+
safetyRatings: (_n = candidate.safetyRatings) != null ? _n : null,
|
|
1289
1430
|
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
1290
|
-
finishMessage: (
|
|
1431
|
+
finishMessage: (_o = candidate.finishMessage) != null ? _o : null,
|
|
1432
|
+
serviceTier: (_p = response.serviceTier) != null ? _p : null
|
|
1291
1433
|
}
|
|
1292
1434
|
},
|
|
1293
1435
|
request: { body: args },
|
|
@@ -1323,6 +1465,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1323
1465
|
let providerMetadata = void 0;
|
|
1324
1466
|
let lastGroundingMetadata = null;
|
|
1325
1467
|
let lastUrlContextMetadata = null;
|
|
1468
|
+
let serviceTier = null;
|
|
1326
1469
|
const generateId3 = this.config.generateId;
|
|
1327
1470
|
let hasToolCalls = false;
|
|
1328
1471
|
let currentTextBlockId = null;
|
|
@@ -1330,6 +1473,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1330
1473
|
let blockCounter = 0;
|
|
1331
1474
|
const emittedSourceUrls = /* @__PURE__ */ new Set();
|
|
1332
1475
|
let lastCodeExecutionToolCallId;
|
|
1476
|
+
let lastServerToolCallId;
|
|
1333
1477
|
return {
|
|
1334
1478
|
stream: response.pipeThrough(
|
|
1335
1479
|
new TransformStream({
|
|
@@ -1337,7 +1481,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1337
1481
|
controller.enqueue({ type: "stream-start", warnings });
|
|
1338
1482
|
},
|
|
1339
1483
|
transform(chunk, controller) {
|
|
1340
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1484
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1341
1485
|
if (options.includeRawChunks) {
|
|
1342
1486
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
1343
1487
|
}
|
|
@@ -1350,6 +1494,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1350
1494
|
if (usageMetadata != null) {
|
|
1351
1495
|
usage = usageMetadata;
|
|
1352
1496
|
}
|
|
1497
|
+
if (value.serviceTier != null) {
|
|
1498
|
+
serviceTier = value.serviceTier;
|
|
1499
|
+
}
|
|
1353
1500
|
const candidate = (_a = value.candidates) == null ? void 0 : _a[0];
|
|
1354
1501
|
if (candidate == null) {
|
|
1355
1502
|
return;
|
|
@@ -1488,6 +1635,42 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1488
1635
|
data: part.inlineData.data,
|
|
1489
1636
|
providerMetadata: fileMeta
|
|
1490
1637
|
});
|
|
1638
|
+
} else if ("toolCall" in part && part.toolCall) {
|
|
1639
|
+
const toolCallId = (_e = part.toolCall.id) != null ? _e : generateId3();
|
|
1640
|
+
lastServerToolCallId = toolCallId;
|
|
1641
|
+
const serverMeta = {
|
|
1642
|
+
[providerOptionsName]: {
|
|
1643
|
+
...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
|
|
1644
|
+
serverToolCallId: toolCallId,
|
|
1645
|
+
serverToolType: part.toolCall.toolType
|
|
1646
|
+
}
|
|
1647
|
+
};
|
|
1648
|
+
controller.enqueue({
|
|
1649
|
+
type: "tool-call",
|
|
1650
|
+
toolCallId,
|
|
1651
|
+
toolName: `server:${part.toolCall.toolType}`,
|
|
1652
|
+
input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
|
|
1653
|
+
providerExecuted: true,
|
|
1654
|
+
dynamic: true,
|
|
1655
|
+
providerMetadata: serverMeta
|
|
1656
|
+
});
|
|
1657
|
+
} else if ("toolResponse" in part && part.toolResponse) {
|
|
1658
|
+
const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : generateId3();
|
|
1659
|
+
const serverMeta = {
|
|
1660
|
+
[providerOptionsName]: {
|
|
1661
|
+
...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
|
|
1662
|
+
serverToolCallId: responseToolCallId,
|
|
1663
|
+
serverToolType: part.toolResponse.toolType
|
|
1664
|
+
}
|
|
1665
|
+
};
|
|
1666
|
+
controller.enqueue({
|
|
1667
|
+
type: "tool-result",
|
|
1668
|
+
toolCallId: responseToolCallId,
|
|
1669
|
+
toolName: `server:${part.toolResponse.toolType}`,
|
|
1670
|
+
result: (_h = part.toolResponse.response) != null ? _h : {},
|
|
1671
|
+
providerMetadata: serverMeta
|
|
1672
|
+
});
|
|
1673
|
+
lastServerToolCallId = void 0;
|
|
1491
1674
|
}
|
|
1492
1675
|
}
|
|
1493
1676
|
const toolCallDeltas = getToolCallsFromParts({
|
|
@@ -1535,12 +1718,13 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1535
1718
|
};
|
|
1536
1719
|
providerMetadata = {
|
|
1537
1720
|
[providerOptionsName]: {
|
|
1538
|
-
promptFeedback: (
|
|
1721
|
+
promptFeedback: (_i = value.promptFeedback) != null ? _i : null,
|
|
1539
1722
|
groundingMetadata: lastGroundingMetadata,
|
|
1540
1723
|
urlContextMetadata: lastUrlContextMetadata,
|
|
1541
|
-
safetyRatings: (
|
|
1724
|
+
safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null,
|
|
1542
1725
|
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
1543
|
-
finishMessage: (
|
|
1726
|
+
finishMessage: (_k = candidate.finishMessage) != null ? _k : null,
|
|
1727
|
+
serviceTier
|
|
1544
1728
|
}
|
|
1545
1729
|
};
|
|
1546
1730
|
}
|
|
@@ -1823,6 +2007,22 @@ var getContentSchema = () => z5.object({
|
|
|
1823
2007
|
thought: z5.boolean().nullish(),
|
|
1824
2008
|
thoughtSignature: z5.string().nullish()
|
|
1825
2009
|
}),
|
|
2010
|
+
z5.object({
|
|
2011
|
+
toolCall: z5.object({
|
|
2012
|
+
toolType: z5.string(),
|
|
2013
|
+
args: z5.unknown().nullish(),
|
|
2014
|
+
id: z5.string()
|
|
2015
|
+
}),
|
|
2016
|
+
thoughtSignature: z5.string().nullish()
|
|
2017
|
+
}),
|
|
2018
|
+
z5.object({
|
|
2019
|
+
toolResponse: z5.object({
|
|
2020
|
+
toolType: z5.string(),
|
|
2021
|
+
response: z5.unknown().nullish(),
|
|
2022
|
+
id: z5.string()
|
|
2023
|
+
}),
|
|
2024
|
+
thoughtSignature: z5.string().nullish()
|
|
2025
|
+
}),
|
|
1826
2026
|
z5.object({
|
|
1827
2027
|
executableCode: z5.object({
|
|
1828
2028
|
language: z5.string(),
|
|
@@ -1881,7 +2081,8 @@ var responseSchema = lazySchema5(
|
|
|
1881
2081
|
promptFeedback: z5.object({
|
|
1882
2082
|
blockReason: z5.string().nullish(),
|
|
1883
2083
|
safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
|
|
1884
|
-
}).nullish()
|
|
2084
|
+
}).nullish(),
|
|
2085
|
+
serviceTier: z5.string().nullish()
|
|
1885
2086
|
})
|
|
1886
2087
|
)
|
|
1887
2088
|
);
|
|
@@ -1902,7 +2103,8 @@ var chunkSchema = lazySchema5(
|
|
|
1902
2103
|
promptFeedback: z5.object({
|
|
1903
2104
|
blockReason: z5.string().nullish(),
|
|
1904
2105
|
safetyRatings: z5.array(getSafetyRatingSchema()).nullish()
|
|
1905
|
-
}).nullish()
|
|
2106
|
+
}).nullish(),
|
|
2107
|
+
serviceTier: z5.string().nullish()
|
|
1906
2108
|
})
|
|
1907
2109
|
)
|
|
1908
2110
|
);
|