@ai-sdk/google 3.0.100 → 3.0.101
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 +6 -0
- package/dist/index.js +16 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +16 -12
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +15 -11
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +15 -11
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/convert-to-google-generative-ai-messages.ts +16 -4
- package/src/google-generative-ai-language-model.ts +1 -0
package/dist/internal/index.mjs
CHANGED
|
@@ -212,7 +212,7 @@ function convertUrlToolResultPart(url) {
|
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
214
|
}
|
|
215
|
-
function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
215
|
+
function appendToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true) {
|
|
216
216
|
const functionResponseParts = [];
|
|
217
217
|
const responseTextParts = [];
|
|
218
218
|
for (const contentPart of outputValue) {
|
|
@@ -251,7 +251,7 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
|
251
251
|
}
|
|
252
252
|
parts.push({
|
|
253
253
|
functionResponse: {
|
|
254
|
-
...toolCallId != null ? { id: toolCallId } : {},
|
|
254
|
+
...includeFunctionCallIds && toolCallId != null ? { id: toolCallId } : {},
|
|
255
255
|
name: toolName,
|
|
256
256
|
response: {
|
|
257
257
|
name: toolName,
|
|
@@ -261,13 +261,13 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
|
261
261
|
}
|
|
262
262
|
});
|
|
263
263
|
}
|
|
264
|
-
function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
264
|
+
function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true) {
|
|
265
265
|
for (const contentPart of outputValue) {
|
|
266
266
|
switch (contentPart.type) {
|
|
267
267
|
case "text":
|
|
268
268
|
parts.push({
|
|
269
269
|
functionResponse: {
|
|
270
|
-
...toolCallId != null ? { id: toolCallId } : {},
|
|
270
|
+
...includeFunctionCallIds && toolCallId != null ? { id: toolCallId } : {},
|
|
271
271
|
name: toolName,
|
|
272
272
|
response: {
|
|
273
273
|
name: toolName,
|
|
@@ -299,7 +299,7 @@ function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
302
|
-
var _a, _b, _c, _d, _e;
|
|
302
|
+
var _a, _b, _c, _d, _e, _f;
|
|
303
303
|
const systemInstructionParts = [];
|
|
304
304
|
const contents = [];
|
|
305
305
|
let systemMessagesAllowed = true;
|
|
@@ -308,6 +308,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
308
308
|
const providerOptionsName = (_c = options == null ? void 0 : options.providerOptionsName) != null ? _c : "google";
|
|
309
309
|
const supportsFunctionResponseParts = (_d = options == null ? void 0 : options.supportsFunctionResponseParts) != null ? _d : true;
|
|
310
310
|
const onWarning = options == null ? void 0 : options.onWarning;
|
|
311
|
+
const includeFunctionCallIds = (_e = options == null ? void 0 : options.includeFunctionCallIds) != null ? _e : true;
|
|
311
312
|
let sentinelInjected = false;
|
|
312
313
|
const missingSignatureToolNames = [];
|
|
313
314
|
const injectSkipSignature = (toolName) => {
|
|
@@ -424,7 +425,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
424
425
|
}
|
|
425
426
|
return {
|
|
426
427
|
functionCall: {
|
|
427
|
-
...part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
428
|
+
...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
428
429
|
name: part.toolName,
|
|
429
430
|
args: part.input
|
|
430
431
|
},
|
|
@@ -488,24 +489,26 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
488
489
|
parts,
|
|
489
490
|
part.toolName,
|
|
490
491
|
output.value,
|
|
491
|
-
part.toolCallId
|
|
492
|
+
part.toolCallId,
|
|
493
|
+
includeFunctionCallIds
|
|
492
494
|
);
|
|
493
495
|
} else {
|
|
494
496
|
appendLegacyToolResultParts(
|
|
495
497
|
parts,
|
|
496
498
|
part.toolName,
|
|
497
499
|
output.value,
|
|
498
|
-
part.toolCallId
|
|
500
|
+
part.toolCallId,
|
|
501
|
+
includeFunctionCallIds
|
|
499
502
|
);
|
|
500
503
|
}
|
|
501
504
|
} else {
|
|
502
505
|
parts.push({
|
|
503
506
|
functionResponse: {
|
|
504
|
-
...part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
507
|
+
...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
505
508
|
name: part.toolName,
|
|
506
509
|
response: {
|
|
507
510
|
name: part.toolName,
|
|
508
|
-
content: output.type === "execution-denied" ? (
|
|
511
|
+
content: output.type === "execution-denied" ? (_f = output.reason) != null ? _f : "Tool call execution denied." : output.value
|
|
509
512
|
}
|
|
510
513
|
}
|
|
511
514
|
});
|
|
@@ -1405,7 +1408,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1405
1408
|
isGemini3Model: usesGemini3Features,
|
|
1406
1409
|
providerOptionsName,
|
|
1407
1410
|
supportsFunctionResponseParts: usesGemini3Features,
|
|
1408
|
-
onWarning: (warning) => warnings.push(warning)
|
|
1411
|
+
onWarning: (warning) => warnings.push(warning),
|
|
1412
|
+
includeFunctionCallIds: !isVertexProvider
|
|
1409
1413
|
}
|
|
1410
1414
|
);
|
|
1411
1415
|
const {
|