@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/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.101" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -452,7 +452,7 @@ function convertUrlToolResultPart(url) {
|
|
|
452
452
|
}
|
|
453
453
|
};
|
|
454
454
|
}
|
|
455
|
-
function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
455
|
+
function appendToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true) {
|
|
456
456
|
const functionResponseParts = [];
|
|
457
457
|
const responseTextParts = [];
|
|
458
458
|
for (const contentPart of outputValue) {
|
|
@@ -491,7 +491,7 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
|
491
491
|
}
|
|
492
492
|
parts.push({
|
|
493
493
|
functionResponse: {
|
|
494
|
-
...toolCallId != null ? { id: toolCallId } : {},
|
|
494
|
+
...includeFunctionCallIds && toolCallId != null ? { id: toolCallId } : {},
|
|
495
495
|
name: toolName,
|
|
496
496
|
response: {
|
|
497
497
|
name: toolName,
|
|
@@ -501,13 +501,13 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
|
501
501
|
}
|
|
502
502
|
});
|
|
503
503
|
}
|
|
504
|
-
function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
504
|
+
function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true) {
|
|
505
505
|
for (const contentPart of outputValue) {
|
|
506
506
|
switch (contentPart.type) {
|
|
507
507
|
case "text":
|
|
508
508
|
parts.push({
|
|
509
509
|
functionResponse: {
|
|
510
|
-
...toolCallId != null ? { id: toolCallId } : {},
|
|
510
|
+
...includeFunctionCallIds && toolCallId != null ? { id: toolCallId } : {},
|
|
511
511
|
name: toolName,
|
|
512
512
|
response: {
|
|
513
513
|
name: toolName,
|
|
@@ -539,7 +539,7 @@ function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId) {
|
|
|
539
539
|
}
|
|
540
540
|
}
|
|
541
541
|
function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
542
|
-
var _a, _b, _c, _d, _e;
|
|
542
|
+
var _a, _b, _c, _d, _e, _f;
|
|
543
543
|
const systemInstructionParts = [];
|
|
544
544
|
const contents = [];
|
|
545
545
|
let systemMessagesAllowed = true;
|
|
@@ -548,6 +548,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
548
548
|
const providerOptionsName = (_c = options == null ? void 0 : options.providerOptionsName) != null ? _c : "google";
|
|
549
549
|
const supportsFunctionResponseParts = (_d = options == null ? void 0 : options.supportsFunctionResponseParts) != null ? _d : true;
|
|
550
550
|
const onWarning = options == null ? void 0 : options.onWarning;
|
|
551
|
+
const includeFunctionCallIds = (_e = options == null ? void 0 : options.includeFunctionCallIds) != null ? _e : true;
|
|
551
552
|
let sentinelInjected = false;
|
|
552
553
|
const missingSignatureToolNames = [];
|
|
553
554
|
const injectSkipSignature = (toolName) => {
|
|
@@ -664,7 +665,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
664
665
|
}
|
|
665
666
|
return {
|
|
666
667
|
functionCall: {
|
|
667
|
-
...part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
668
|
+
...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
668
669
|
name: part.toolName,
|
|
669
670
|
args: part.input
|
|
670
671
|
},
|
|
@@ -728,24 +729,26 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
|
|
|
728
729
|
parts,
|
|
729
730
|
part.toolName,
|
|
730
731
|
output.value,
|
|
731
|
-
part.toolCallId
|
|
732
|
+
part.toolCallId,
|
|
733
|
+
includeFunctionCallIds
|
|
732
734
|
);
|
|
733
735
|
} else {
|
|
734
736
|
appendLegacyToolResultParts(
|
|
735
737
|
parts,
|
|
736
738
|
part.toolName,
|
|
737
739
|
output.value,
|
|
738
|
-
part.toolCallId
|
|
740
|
+
part.toolCallId,
|
|
741
|
+
includeFunctionCallIds
|
|
739
742
|
);
|
|
740
743
|
}
|
|
741
744
|
} else {
|
|
742
745
|
parts.push({
|
|
743
746
|
functionResponse: {
|
|
744
|
-
...part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
747
|
+
...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
|
|
745
748
|
name: part.toolName,
|
|
746
749
|
response: {
|
|
747
750
|
name: part.toolName,
|
|
748
|
-
content: output.type === "execution-denied" ? (
|
|
751
|
+
content: output.type === "execution-denied" ? (_f = output.reason) != null ? _f : "Tool call execution denied." : output.value
|
|
749
752
|
}
|
|
750
753
|
}
|
|
751
754
|
});
|
|
@@ -1622,7 +1625,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1622
1625
|
isGemini3Model: usesGemini3Features,
|
|
1623
1626
|
providerOptionsName,
|
|
1624
1627
|
supportsFunctionResponseParts: usesGemini3Features,
|
|
1625
|
-
onWarning: (warning) => warnings.push(warning)
|
|
1628
|
+
onWarning: (warning) => warnings.push(warning),
|
|
1629
|
+
includeFunctionCallIds: !isVertexProvider
|
|
1626
1630
|
}
|
|
1627
1631
|
);
|
|
1628
1632
|
const {
|