@ai-sdk/google 3.0.54 → 3.0.56
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 +13 -0
- package/dist/index.d.mts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +205 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +205 -20
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +14 -0
- package/dist/internal/index.d.ts +14 -0
- package/dist/internal/index.js +204 -19
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +204 -19
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/convert-to-google-generative-ai-messages.ts +87 -0
- package/src/google-generative-ai-language-model.ts +117 -0
- package/src/google-generative-ai-prompt.ts +17 -1
- package/src/google-prepare-tools.ts +57 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 3.0.56
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [0469aed]
|
|
8
|
+
- @ai-sdk/provider-utils@4.0.22
|
|
9
|
+
|
|
10
|
+
## 3.0.55
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- bdde9d4: feat(provider/google): support combining built-in tools with function calling on Gemini 3
|
|
15
|
+
|
|
3
16
|
## 3.0.54
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -59,6 +59,20 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
59
59
|
};
|
|
60
60
|
thought?: boolean | null | undefined;
|
|
61
61
|
thoughtSignature?: string | null | undefined;
|
|
62
|
+
} | {
|
|
63
|
+
toolCall: {
|
|
64
|
+
toolType: string;
|
|
65
|
+
id: string;
|
|
66
|
+
args?: unknown;
|
|
67
|
+
};
|
|
68
|
+
thoughtSignature?: string | null | undefined;
|
|
69
|
+
} | {
|
|
70
|
+
toolResponse: {
|
|
71
|
+
toolType: string;
|
|
72
|
+
id: string;
|
|
73
|
+
response?: unknown;
|
|
74
|
+
};
|
|
75
|
+
thoughtSignature?: string | null | undefined;
|
|
62
76
|
} | {
|
|
63
77
|
executableCode?: {
|
|
64
78
|
language: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -59,6 +59,20 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
59
59
|
};
|
|
60
60
|
thought?: boolean | null | undefined;
|
|
61
61
|
thoughtSignature?: string | null | undefined;
|
|
62
|
+
} | {
|
|
63
|
+
toolCall: {
|
|
64
|
+
toolType: string;
|
|
65
|
+
id: string;
|
|
66
|
+
args?: unknown;
|
|
67
|
+
};
|
|
68
|
+
thoughtSignature?: string | null | undefined;
|
|
69
|
+
} | {
|
|
70
|
+
toolResponse: {
|
|
71
|
+
toolType: string;
|
|
72
|
+
id: string;
|
|
73
|
+
response?: unknown;
|
|
74
|
+
};
|
|
75
|
+
thoughtSignature?: string | null | undefined;
|
|
62
76
|
} | {
|
|
63
77
|
executableCode?: {
|
|
64
78
|
language: string;
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
30
30
|
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = true ? "3.0.
|
|
33
|
+
var VERSION = true ? "3.0.56" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/google-generative-ai-embedding-model.ts
|
|
36
36
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -505,7 +505,7 @@ function appendLegacyToolResultParts(parts, toolName, outputValue) {
|
|
|
505
505
|
}
|
|
506
506
|
}
|
|
507
507
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
508
|
-
var _a, _b, _c, _d;
|
|
508
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
509
509
|
const systemInstructionParts = [];
|
|
510
510
|
const contents = [];
|
|
511
511
|
let systemMessagesAllowed = true;
|
|
@@ -592,6 +592,18 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
592
592
|
};
|
|
593
593
|
}
|
|
594
594
|
case "tool-call": {
|
|
595
|
+
const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
|
|
596
|
+
const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
|
|
597
|
+
if (serverToolCallId && serverToolType) {
|
|
598
|
+
return {
|
|
599
|
+
toolCall: {
|
|
600
|
+
toolType: serverToolType,
|
|
601
|
+
args: typeof part.input === "string" ? JSON.parse(part.input) : part.input,
|
|
602
|
+
id: serverToolCallId
|
|
603
|
+
},
|
|
604
|
+
thoughtSignature
|
|
605
|
+
};
|
|
606
|
+
}
|
|
595
607
|
return {
|
|
596
608
|
functionCall: {
|
|
597
609
|
name: part.toolName,
|
|
@@ -600,6 +612,21 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
600
612
|
thoughtSignature
|
|
601
613
|
};
|
|
602
614
|
}
|
|
615
|
+
case "tool-result": {
|
|
616
|
+
const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
|
|
617
|
+
const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
|
|
618
|
+
if (serverToolCallId && serverToolType) {
|
|
619
|
+
return {
|
|
620
|
+
toolResponse: {
|
|
621
|
+
toolType: serverToolType,
|
|
622
|
+
response: part.output.type === "json" ? part.output.value : {},
|
|
623
|
+
id: serverToolCallId
|
|
624
|
+
},
|
|
625
|
+
thoughtSignature
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
return void 0;
|
|
629
|
+
}
|
|
603
630
|
}
|
|
604
631
|
}).filter((part) => part !== void 0)
|
|
605
632
|
});
|
|
@@ -612,6 +639,26 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
612
639
|
if (part.type === "tool-approval-response") {
|
|
613
640
|
continue;
|
|
614
641
|
}
|
|
642
|
+
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;
|
|
643
|
+
const serverToolCallId = (partProviderOpts == null ? void 0 : partProviderOpts.serverToolCallId) != null ? String(partProviderOpts.serverToolCallId) : void 0;
|
|
644
|
+
const serverToolType = (partProviderOpts == null ? void 0 : partProviderOpts.serverToolType) != null ? String(partProviderOpts.serverToolType) : void 0;
|
|
645
|
+
if (serverToolCallId && serverToolType) {
|
|
646
|
+
const serverThoughtSignature = (partProviderOpts == null ? void 0 : partProviderOpts.thoughtSignature) != null ? String(partProviderOpts.thoughtSignature) : void 0;
|
|
647
|
+
if (contents.length > 0) {
|
|
648
|
+
const lastContent = contents[contents.length - 1];
|
|
649
|
+
if (lastContent.role === "model") {
|
|
650
|
+
lastContent.parts.push({
|
|
651
|
+
toolResponse: {
|
|
652
|
+
toolType: serverToolType,
|
|
653
|
+
response: part.output.type === "json" ? part.output.value : {},
|
|
654
|
+
id: serverToolCallId
|
|
655
|
+
},
|
|
656
|
+
thoughtSignature: serverThoughtSignature
|
|
657
|
+
});
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
615
662
|
const output = part.output;
|
|
616
663
|
if (output.type === "content") {
|
|
617
664
|
if (supportsFunctionResponseParts) {
|
|
@@ -625,7 +672,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
625
672
|
name: part.toolName,
|
|
626
673
|
response: {
|
|
627
674
|
name: part.toolName,
|
|
628
|
-
content: output.type === "execution-denied" ? (
|
|
675
|
+
content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool execution denied." : output.value
|
|
629
676
|
}
|
|
630
677
|
}
|
|
631
678
|
});
|
|
@@ -791,7 +838,7 @@ function prepareTools({
|
|
|
791
838
|
toolChoice,
|
|
792
839
|
modelId
|
|
793
840
|
}) {
|
|
794
|
-
var _a;
|
|
841
|
+
var _a, _b;
|
|
795
842
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
796
843
|
const toolWarnings = [];
|
|
797
844
|
const isLatest = [
|
|
@@ -800,13 +847,14 @@ function prepareTools({
|
|
|
800
847
|
"gemini-pro-latest"
|
|
801
848
|
].some((id) => id === modelId);
|
|
802
849
|
const isGemini2orNewer = modelId.includes("gemini-2") || modelId.includes("gemini-3") || modelId.includes("nano-banana") || isLatest;
|
|
850
|
+
const isGemini3orNewer = modelId.includes("gemini-3");
|
|
803
851
|
const supportsFileSearch = modelId.includes("gemini-2.5") || modelId.includes("gemini-3");
|
|
804
852
|
if (tools == null) {
|
|
805
853
|
return { tools: void 0, toolConfig: void 0, toolWarnings };
|
|
806
854
|
}
|
|
807
855
|
const hasFunctionTools = tools.some((tool) => tool.type === "function");
|
|
808
856
|
const hasProviderTools = tools.some((tool) => tool.type === "provider");
|
|
809
|
-
if (hasFunctionTools && hasProviderTools) {
|
|
857
|
+
if (hasFunctionTools && hasProviderTools && !isGemini3orNewer) {
|
|
810
858
|
toolWarnings.push({
|
|
811
859
|
type: "unsupported",
|
|
812
860
|
feature: `combination of function and provider-defined tools`
|
|
@@ -911,6 +959,45 @@ function prepareTools({
|
|
|
911
959
|
break;
|
|
912
960
|
}
|
|
913
961
|
});
|
|
962
|
+
if (hasFunctionTools && isGemini3orNewer && googleTools2.length > 0) {
|
|
963
|
+
const functionDeclarations2 = [];
|
|
964
|
+
for (const tool of tools) {
|
|
965
|
+
if (tool.type === "function") {
|
|
966
|
+
functionDeclarations2.push({
|
|
967
|
+
name: tool.name,
|
|
968
|
+
description: (_a = tool.description) != null ? _a : "",
|
|
969
|
+
parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
const combinedToolConfig = {
|
|
974
|
+
functionCallingConfig: { mode: "VALIDATED" },
|
|
975
|
+
includeServerSideToolInvocations: true
|
|
976
|
+
};
|
|
977
|
+
if (toolChoice != null) {
|
|
978
|
+
switch (toolChoice.type) {
|
|
979
|
+
case "auto":
|
|
980
|
+
break;
|
|
981
|
+
case "none":
|
|
982
|
+
combinedToolConfig.functionCallingConfig = { mode: "NONE" };
|
|
983
|
+
break;
|
|
984
|
+
case "required":
|
|
985
|
+
combinedToolConfig.functionCallingConfig = { mode: "ANY" };
|
|
986
|
+
break;
|
|
987
|
+
case "tool":
|
|
988
|
+
combinedToolConfig.functionCallingConfig = {
|
|
989
|
+
mode: "ANY",
|
|
990
|
+
allowedFunctionNames: [toolChoice.toolName]
|
|
991
|
+
};
|
|
992
|
+
break;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
return {
|
|
996
|
+
tools: [...googleTools2, { functionDeclarations: functionDeclarations2 }],
|
|
997
|
+
toolConfig: combinedToolConfig,
|
|
998
|
+
toolWarnings
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
914
1001
|
return {
|
|
915
1002
|
tools: googleTools2.length > 0 ? googleTools2 : void 0,
|
|
916
1003
|
toolConfig: void 0,
|
|
@@ -924,7 +1011,7 @@ function prepareTools({
|
|
|
924
1011
|
case "function":
|
|
925
1012
|
functionDeclarations.push({
|
|
926
1013
|
name: tool.name,
|
|
927
|
-
description: (
|
|
1014
|
+
description: (_b = tool.description) != null ? _b : "",
|
|
928
1015
|
parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
|
|
929
1016
|
});
|
|
930
1017
|
if (tool.strict === true) {
|
|
@@ -1141,7 +1228,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1141
1228
|
};
|
|
1142
1229
|
}
|
|
1143
1230
|
async doGenerate(options) {
|
|
1144
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1231
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
|
|
1145
1232
|
const { args, warnings, providerOptionsName } = await this.getArgs(options);
|
|
1146
1233
|
const mergedHeaders = (0, import_provider_utils6.combineHeaders)(
|
|
1147
1234
|
await (0, import_provider_utils6.resolve)(this.config.headers),
|
|
@@ -1167,6 +1254,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1167
1254
|
const parts = (_b = (_a = candidate.content) == null ? void 0 : _a.parts) != null ? _b : [];
|
|
1168
1255
|
const usageMetadata = response.usageMetadata;
|
|
1169
1256
|
let lastCodeExecutionToolCallId;
|
|
1257
|
+
let lastServerToolCallId;
|
|
1170
1258
|
for (const part of parts) {
|
|
1171
1259
|
if ("executableCode" in part && ((_c = part.executableCode) == null ? void 0 : _c.code)) {
|
|
1172
1260
|
const toolCallId = this.config.generateId();
|
|
@@ -1234,12 +1322,56 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1234
1322
|
}
|
|
1235
1323
|
} : void 0
|
|
1236
1324
|
});
|
|
1325
|
+
} else if ("toolCall" in part && part.toolCall) {
|
|
1326
|
+
const toolCallId = (_e = part.toolCall.id) != null ? _e : this.config.generateId();
|
|
1327
|
+
lastServerToolCallId = toolCallId;
|
|
1328
|
+
content.push({
|
|
1329
|
+
type: "tool-call",
|
|
1330
|
+
toolCallId,
|
|
1331
|
+
toolName: `server:${part.toolCall.toolType}`,
|
|
1332
|
+
input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
|
|
1333
|
+
providerExecuted: true,
|
|
1334
|
+
dynamic: true,
|
|
1335
|
+
providerMetadata: part.thoughtSignature ? {
|
|
1336
|
+
[providerOptionsName]: {
|
|
1337
|
+
thoughtSignature: part.thoughtSignature,
|
|
1338
|
+
serverToolCallId: toolCallId,
|
|
1339
|
+
serverToolType: part.toolCall.toolType
|
|
1340
|
+
}
|
|
1341
|
+
} : {
|
|
1342
|
+
[providerOptionsName]: {
|
|
1343
|
+
serverToolCallId: toolCallId,
|
|
1344
|
+
serverToolType: part.toolCall.toolType
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
});
|
|
1348
|
+
} else if ("toolResponse" in part && part.toolResponse) {
|
|
1349
|
+
const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : this.config.generateId();
|
|
1350
|
+
content.push({
|
|
1351
|
+
type: "tool-result",
|
|
1352
|
+
toolCallId: responseToolCallId,
|
|
1353
|
+
toolName: `server:${part.toolResponse.toolType}`,
|
|
1354
|
+
result: (_h = part.toolResponse.response) != null ? _h : {},
|
|
1355
|
+
providerMetadata: part.thoughtSignature ? {
|
|
1356
|
+
[providerOptionsName]: {
|
|
1357
|
+
thoughtSignature: part.thoughtSignature,
|
|
1358
|
+
serverToolCallId: responseToolCallId,
|
|
1359
|
+
serverToolType: part.toolResponse.toolType
|
|
1360
|
+
}
|
|
1361
|
+
} : {
|
|
1362
|
+
[providerOptionsName]: {
|
|
1363
|
+
serverToolCallId: responseToolCallId,
|
|
1364
|
+
serverToolType: part.toolResponse.toolType
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
});
|
|
1368
|
+
lastServerToolCallId = void 0;
|
|
1237
1369
|
}
|
|
1238
1370
|
}
|
|
1239
|
-
const sources = (
|
|
1371
|
+
const sources = (_i = extractSources({
|
|
1240
1372
|
groundingMetadata: candidate.groundingMetadata,
|
|
1241
1373
|
generateId: this.config.generateId
|
|
1242
|
-
})) != null ?
|
|
1374
|
+
})) != null ? _i : [];
|
|
1243
1375
|
for (const source of sources) {
|
|
1244
1376
|
content.push(source);
|
|
1245
1377
|
}
|
|
@@ -1253,19 +1385,19 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1253
1385
|
(part) => part.type === "tool-call" && !part.providerExecuted
|
|
1254
1386
|
)
|
|
1255
1387
|
}),
|
|
1256
|
-
raw: (
|
|
1388
|
+
raw: (_j = candidate.finishReason) != null ? _j : void 0
|
|
1257
1389
|
},
|
|
1258
1390
|
usage: convertGoogleGenerativeAIUsage(usageMetadata),
|
|
1259
1391
|
warnings,
|
|
1260
1392
|
providerMetadata: {
|
|
1261
1393
|
[providerOptionsName]: {
|
|
1262
|
-
promptFeedback: (
|
|
1263
|
-
groundingMetadata: (
|
|
1264
|
-
urlContextMetadata: (
|
|
1265
|
-
safetyRatings: (
|
|
1394
|
+
promptFeedback: (_k = response.promptFeedback) != null ? _k : null,
|
|
1395
|
+
groundingMetadata: (_l = candidate.groundingMetadata) != null ? _l : null,
|
|
1396
|
+
urlContextMetadata: (_m = candidate.urlContextMetadata) != null ? _m : null,
|
|
1397
|
+
safetyRatings: (_n = candidate.safetyRatings) != null ? _n : null,
|
|
1266
1398
|
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
1267
|
-
finishMessage: (
|
|
1268
|
-
serviceTier: (
|
|
1399
|
+
finishMessage: (_o = candidate.finishMessage) != null ? _o : null,
|
|
1400
|
+
serviceTier: (_p = response.serviceTier) != null ? _p : null
|
|
1269
1401
|
}
|
|
1270
1402
|
},
|
|
1271
1403
|
request: { body: args },
|
|
@@ -1309,6 +1441,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1309
1441
|
let blockCounter = 0;
|
|
1310
1442
|
const emittedSourceUrls = /* @__PURE__ */ new Set();
|
|
1311
1443
|
let lastCodeExecutionToolCallId;
|
|
1444
|
+
let lastServerToolCallId;
|
|
1312
1445
|
return {
|
|
1313
1446
|
stream: response.pipeThrough(
|
|
1314
1447
|
new TransformStream({
|
|
@@ -1316,7 +1449,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1316
1449
|
controller.enqueue({ type: "stream-start", warnings });
|
|
1317
1450
|
},
|
|
1318
1451
|
transform(chunk, controller) {
|
|
1319
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
1452
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1320
1453
|
if (options.includeRawChunks) {
|
|
1321
1454
|
controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
|
|
1322
1455
|
}
|
|
@@ -1471,6 +1604,42 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1471
1604
|
data: part.inlineData.data,
|
|
1472
1605
|
providerMetadata: fileMeta
|
|
1473
1606
|
});
|
|
1607
|
+
} else if ("toolCall" in part && part.toolCall) {
|
|
1608
|
+
const toolCallId = (_e = part.toolCall.id) != null ? _e : generateId3();
|
|
1609
|
+
lastServerToolCallId = toolCallId;
|
|
1610
|
+
const serverMeta = {
|
|
1611
|
+
[providerOptionsName]: {
|
|
1612
|
+
...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
|
|
1613
|
+
serverToolCallId: toolCallId,
|
|
1614
|
+
serverToolType: part.toolCall.toolType
|
|
1615
|
+
}
|
|
1616
|
+
};
|
|
1617
|
+
controller.enqueue({
|
|
1618
|
+
type: "tool-call",
|
|
1619
|
+
toolCallId,
|
|
1620
|
+
toolName: `server:${part.toolCall.toolType}`,
|
|
1621
|
+
input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
|
|
1622
|
+
providerExecuted: true,
|
|
1623
|
+
dynamic: true,
|
|
1624
|
+
providerMetadata: serverMeta
|
|
1625
|
+
});
|
|
1626
|
+
} else if ("toolResponse" in part && part.toolResponse) {
|
|
1627
|
+
const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : generateId3();
|
|
1628
|
+
const serverMeta = {
|
|
1629
|
+
[providerOptionsName]: {
|
|
1630
|
+
...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
|
|
1631
|
+
serverToolCallId: responseToolCallId,
|
|
1632
|
+
serverToolType: part.toolResponse.toolType
|
|
1633
|
+
}
|
|
1634
|
+
};
|
|
1635
|
+
controller.enqueue({
|
|
1636
|
+
type: "tool-result",
|
|
1637
|
+
toolCallId: responseToolCallId,
|
|
1638
|
+
toolName: `server:${part.toolResponse.toolType}`,
|
|
1639
|
+
result: (_h = part.toolResponse.response) != null ? _h : {},
|
|
1640
|
+
providerMetadata: serverMeta
|
|
1641
|
+
});
|
|
1642
|
+
lastServerToolCallId = void 0;
|
|
1474
1643
|
}
|
|
1475
1644
|
}
|
|
1476
1645
|
const toolCallDeltas = getToolCallsFromParts({
|
|
@@ -1518,12 +1687,12 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1518
1687
|
};
|
|
1519
1688
|
providerMetadata = {
|
|
1520
1689
|
[providerOptionsName]: {
|
|
1521
|
-
promptFeedback: (
|
|
1690
|
+
promptFeedback: (_i = value.promptFeedback) != null ? _i : null,
|
|
1522
1691
|
groundingMetadata: lastGroundingMetadata,
|
|
1523
1692
|
urlContextMetadata: lastUrlContextMetadata,
|
|
1524
|
-
safetyRatings: (
|
|
1693
|
+
safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null,
|
|
1525
1694
|
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
1526
|
-
finishMessage: (
|
|
1695
|
+
finishMessage: (_k = candidate.finishMessage) != null ? _k : null,
|
|
1527
1696
|
serviceTier
|
|
1528
1697
|
}
|
|
1529
1698
|
};
|
|
@@ -1738,6 +1907,22 @@ var getContentSchema = () => import_v45.z.object({
|
|
|
1738
1907
|
thought: import_v45.z.boolean().nullish(),
|
|
1739
1908
|
thoughtSignature: import_v45.z.string().nullish()
|
|
1740
1909
|
}),
|
|
1910
|
+
import_v45.z.object({
|
|
1911
|
+
toolCall: import_v45.z.object({
|
|
1912
|
+
toolType: import_v45.z.string(),
|
|
1913
|
+
args: import_v45.z.unknown().nullish(),
|
|
1914
|
+
id: import_v45.z.string()
|
|
1915
|
+
}),
|
|
1916
|
+
thoughtSignature: import_v45.z.string().nullish()
|
|
1917
|
+
}),
|
|
1918
|
+
import_v45.z.object({
|
|
1919
|
+
toolResponse: import_v45.z.object({
|
|
1920
|
+
toolType: import_v45.z.string(),
|
|
1921
|
+
response: import_v45.z.unknown().nullish(),
|
|
1922
|
+
id: import_v45.z.string()
|
|
1923
|
+
}),
|
|
1924
|
+
thoughtSignature: import_v45.z.string().nullish()
|
|
1925
|
+
}),
|
|
1741
1926
|
import_v45.z.object({
|
|
1742
1927
|
executableCode: import_v45.z.object({
|
|
1743
1928
|
language: import_v45.z.string(),
|