@ai-sdk/google 4.0.23 → 4.0.24
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/internal/index.js +15 -11
- package/dist/internal/index.js.map +1 -1
- package/package.json +1 -1
- package/src/convert-to-google-messages.ts +16 -4
- package/src/google-language-model.ts +1 -0
package/package.json
CHANGED
|
@@ -76,6 +76,7 @@ function appendToolResultParts(
|
|
|
76
76
|
{ type: 'content' }
|
|
77
77
|
>['value'],
|
|
78
78
|
toolCallId?: string,
|
|
79
|
+
includeFunctionCallIds = true,
|
|
79
80
|
): void {
|
|
80
81
|
const functionResponseParts: GoogleFunctionResponsePart[] = [];
|
|
81
82
|
const responseTextParts: string[] = [];
|
|
@@ -118,7 +119,9 @@ function appendToolResultParts(
|
|
|
118
119
|
|
|
119
120
|
parts.push({
|
|
120
121
|
functionResponse: {
|
|
121
|
-
...(toolCallId != null
|
|
122
|
+
...(includeFunctionCallIds && toolCallId != null
|
|
123
|
+
? { id: toolCallId }
|
|
124
|
+
: {}),
|
|
122
125
|
name: toolName,
|
|
123
126
|
response: {
|
|
124
127
|
name: toolName,
|
|
@@ -147,13 +150,16 @@ function appendLegacyToolResultParts(
|
|
|
147
150
|
{ type: 'content' }
|
|
148
151
|
>['value'],
|
|
149
152
|
toolCallId?: string,
|
|
153
|
+
includeFunctionCallIds = true,
|
|
150
154
|
): void {
|
|
151
155
|
for (const contentPart of outputValue) {
|
|
152
156
|
switch (contentPart.type) {
|
|
153
157
|
case 'text':
|
|
154
158
|
parts.push({
|
|
155
159
|
functionResponse: {
|
|
156
|
-
...(toolCallId != null
|
|
160
|
+
...(includeFunctionCallIds && toolCallId != null
|
|
161
|
+
? { id: toolCallId }
|
|
162
|
+
: {}),
|
|
157
163
|
name: toolName,
|
|
158
164
|
response: {
|
|
159
165
|
name: toolName,
|
|
@@ -206,6 +212,7 @@ export function convertToGoogleMessages(
|
|
|
206
212
|
*/
|
|
207
213
|
providerOptionsNames?: readonly string[];
|
|
208
214
|
supportsFunctionResponseParts?: boolean;
|
|
215
|
+
includeFunctionCallIds?: boolean;
|
|
209
216
|
},
|
|
210
217
|
): GooglePrompt {
|
|
211
218
|
const systemInstructionParts: Array<{ text: string }> = [];
|
|
@@ -218,6 +225,7 @@ export function convertToGoogleMessages(
|
|
|
218
225
|
const isVertexLike = !providerOptionsNames.includes('google');
|
|
219
226
|
const supportsFunctionResponseParts =
|
|
220
227
|
options?.supportsFunctionResponseParts ?? true;
|
|
228
|
+
const includeFunctionCallIds = options?.includeFunctionCallIds ?? true;
|
|
221
229
|
|
|
222
230
|
let sentinelInjected = false;
|
|
223
231
|
const missingSignatureToolNames: string[] = [];
|
|
@@ -497,7 +505,7 @@ export function convertToGoogleMessages(
|
|
|
497
505
|
|
|
498
506
|
return {
|
|
499
507
|
functionCall: {
|
|
500
|
-
...(part.toolCallId != null
|
|
508
|
+
...(includeFunctionCallIds && part.toolCallId != null
|
|
501
509
|
? { id: part.toolCallId }
|
|
502
510
|
: {}),
|
|
503
511
|
name: part.toolName,
|
|
@@ -591,6 +599,7 @@ export function convertToGoogleMessages(
|
|
|
591
599
|
part.toolName,
|
|
592
600
|
output.value,
|
|
593
601
|
part.toolCallId,
|
|
602
|
+
includeFunctionCallIds,
|
|
594
603
|
);
|
|
595
604
|
} else {
|
|
596
605
|
appendLegacyToolResultParts(
|
|
@@ -598,12 +607,15 @@ export function convertToGoogleMessages(
|
|
|
598
607
|
part.toolName,
|
|
599
608
|
output.value,
|
|
600
609
|
part.toolCallId,
|
|
610
|
+
includeFunctionCallIds,
|
|
601
611
|
);
|
|
602
612
|
}
|
|
603
613
|
} else {
|
|
604
614
|
parts.push({
|
|
605
615
|
functionResponse: {
|
|
606
|
-
...(part.toolCallId != null
|
|
616
|
+
...(includeFunctionCallIds && part.toolCallId != null
|
|
617
|
+
? { id: part.toolCallId }
|
|
618
|
+
: {}),
|
|
607
619
|
name: part.toolName,
|
|
608
620
|
response: {
|
|
609
621
|
name: part.toolName,
|
|
@@ -266,6 +266,7 @@ export class GoogleLanguageModel implements LanguageModelV4 {
|
|
|
266
266
|
onWarning: warning => warnings.push(warning),
|
|
267
267
|
providerOptionsNames,
|
|
268
268
|
supportsFunctionResponseParts: usesGemini3Features,
|
|
269
|
+
includeFunctionCallIds: !isVertexProvider,
|
|
269
270
|
});
|
|
270
271
|
|
|
271
272
|
const {
|