@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.js
CHANGED
|
@@ -230,7 +230,7 @@ function convertUrlToolResultPart(url) {
|
|
|
230
230
|
}
|
|
231
231
|
};
|
|
232
232
|
}
|
|
233
|
-
function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
233
|
+
function appendToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true) {
|
|
234
234
|
const functionResponseParts = [];
|
|
235
235
|
const responseTextParts = [];
|
|
236
236
|
for (const contentPart of outputValue) {
|
|
@@ -269,7 +269,7 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
|
269
269
|
}
|
|
270
270
|
parts.push({
|
|
271
271
|
functionResponse: {
|
|
272
|
-
...toolCallId != null ? { id: toolCallId } : {},
|
|
272
|
+
...includeFunctionCallIds && toolCallId != null ? { id: toolCallId } : {},
|
|
273
273
|
name: toolName,
|
|
274
274
|
response: {
|
|
275
275
|
name: toolName,
|
|
@@ -279,13 +279,13 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
|
279
279
|
}
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
|
-
function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
282
|
+
function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true) {
|
|
283
283
|
for (const contentPart of outputValue) {
|
|
284
284
|
switch (contentPart.type) {
|
|
285
285
|
case "text":
|
|
286
286
|
parts.push({
|
|
287
287
|
functionResponse: {
|
|
288
|
-
...toolCallId != null ? { id: toolCallId } : {},
|
|
288
|
+
...includeFunctionCallIds && toolCallId != null ? { id: toolCallId } : {},
|
|
289
289
|
name: toolName,
|
|
290
290
|
response: {
|
|
291
291
|
name: toolName,
|
|
@@ -317,7 +317,7 @@ function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
319
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
320
|
-
var _a, _b, _c, _d, _e;
|
|
320
|
+
var _a, _b, _c, _d, _e, _f;
|
|
321
321
|
const systemInstructionParts = [];
|
|
322
322
|
const contents = [];
|
|
323
323
|
let systemMessagesAllowed = true;
|
|
@@ -326,6 +326,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
326
326
|
const providerOptionsName = (_c = options == null ? void 0 : options.providerOptionsName) != null ? _c : "google";
|
|
327
327
|
const supportsFunctionResponseParts = (_d = options == null ? void 0 : options.supportsFunctionResponseParts) != null ? _d : true;
|
|
328
328
|
const onWarning = options == null ? void 0 : options.onWarning;
|
|
329
|
+
const includeFunctionCallIds = (_e = options == null ? void 0 : options.includeFunctionCallIds) != null ? _e : true;
|
|
329
330
|
let sentinelInjected = false;
|
|
330
331
|
const missingSignatureToolNames = [];
|
|
331
332
|
const injectSkipSignature = (toolName) => {
|
|
@@ -442,7 +443,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
442
443
|
}
|
|
443
444
|
return {
|
|
444
445
|
functionCall: {
|
|
445
|
-
...part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
446
|
+
...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
446
447
|
name: part.toolName,
|
|
447
448
|
args: part.input
|
|
448
449
|
},
|
|
@@ -506,24 +507,26 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
506
507
|
parts,
|
|
507
508
|
part.toolName,
|
|
508
509
|
output.value,
|
|
509
|
-
part.toolCallId
|
|
510
|
+
part.toolCallId,
|
|
511
|
+
includeFunctionCallIds
|
|
510
512
|
);
|
|
511
513
|
} else {
|
|
512
514
|
appendLegacyToolResultParts(
|
|
513
515
|
parts,
|
|
514
516
|
part.toolName,
|
|
515
517
|
output.value,
|
|
516
|
-
part.toolCallId
|
|
518
|
+
part.toolCallId,
|
|
519
|
+
includeFunctionCallIds
|
|
517
520
|
);
|
|
518
521
|
}
|
|
519
522
|
} else {
|
|
520
523
|
parts.push({
|
|
521
524
|
functionResponse: {
|
|
522
|
-
...part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
525
|
+
...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
523
526
|
name: part.toolName,
|
|
524
527
|
response: {
|
|
525
528
|
name: part.toolName,
|
|
526
|
-
content: output.type === "execution-denied" ? (
|
|
529
|
+
content: output.type === "execution-denied" ? (_f = output.reason) != null ? _f : "Tool call execution denied." : output.value
|
|
527
530
|
}
|
|
528
531
|
}
|
|
529
532
|
});
|
|
@@ -1414,7 +1417,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1414
1417
|
isGemini3Model: usesGemini3Features,
|
|
1415
1418
|
providerOptionsName,
|
|
1416
1419
|
supportsFunctionResponseParts: usesGemini3Features,
|
|
1417
|
-
onWarning: (warning) => warnings.push(warning)
|
|
1420
|
+
onWarning: (warning) => warnings.push(warning),
|
|
1421
|
+
includeFunctionCallIds: !isVertexProvider
|
|
1418
1422
|
}
|
|
1419
1423
|
);
|
|
1420
1424
|
const {
|