@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/package.json
CHANGED
|
@@ -101,6 +101,7 @@ function appendToolResultParts(
|
|
|
101
101
|
[key: string]: unknown;
|
|
102
102
|
}>,
|
|
103
103
|
toolCallId?: string,
|
|
104
|
+
includeFunctionCallIds = true,
|
|
104
105
|
): void {
|
|
105
106
|
const functionResponseParts: GoogleGenerativeAIFunctionResponsePart[] = [];
|
|
106
107
|
const responseTextParts: string[] = [];
|
|
@@ -143,7 +144,9 @@ function appendToolResultParts(
|
|
|
143
144
|
|
|
144
145
|
parts.push({
|
|
145
146
|
functionResponse: {
|
|
146
|
-
...(toolCallId != null
|
|
147
|
+
...(includeFunctionCallIds && toolCallId != null
|
|
148
|
+
? { id: toolCallId }
|
|
149
|
+
: {}),
|
|
147
150
|
name: toolName,
|
|
148
151
|
response: {
|
|
149
152
|
name: toolName,
|
|
@@ -172,13 +175,16 @@ function appendLegacyToolResultParts(
|
|
|
172
175
|
[key: string]: unknown;
|
|
173
176
|
}>,
|
|
174
177
|
toolCallId?: string,
|
|
178
|
+
includeFunctionCallIds = true,
|
|
175
179
|
): void {
|
|
176
180
|
for (const contentPart of outputValue) {
|
|
177
181
|
switch (contentPart.type) {
|
|
178
182
|
case 'text':
|
|
179
183
|
parts.push({
|
|
180
184
|
functionResponse: {
|
|
181
|
-
...(toolCallId != null
|
|
185
|
+
...(includeFunctionCallIds && toolCallId != null
|
|
186
|
+
? { id: toolCallId }
|
|
187
|
+
: {}),
|
|
182
188
|
name: toolName,
|
|
183
189
|
response: {
|
|
184
190
|
name: toolName,
|
|
@@ -234,6 +240,7 @@ export function convertToGoogleGenerativeAIMessages(
|
|
|
234
240
|
* injected.
|
|
235
241
|
*/
|
|
236
242
|
onWarning?: (warning: SharedV3Warning) => void;
|
|
243
|
+
includeFunctionCallIds?: boolean;
|
|
237
244
|
},
|
|
238
245
|
): GoogleGenerativeAIPrompt {
|
|
239
246
|
const systemInstructionParts: Array<{ text: string }> = [];
|
|
@@ -245,6 +252,7 @@ export function convertToGoogleGenerativeAIMessages(
|
|
|
245
252
|
const supportsFunctionResponseParts =
|
|
246
253
|
options?.supportsFunctionResponseParts ?? true;
|
|
247
254
|
const onWarning = options?.onWarning;
|
|
255
|
+
const includeFunctionCallIds = options?.includeFunctionCallIds ?? true;
|
|
248
256
|
|
|
249
257
|
let sentinelInjected = false;
|
|
250
258
|
const missingSignatureToolNames: string[] = [];
|
|
@@ -413,7 +421,7 @@ export function convertToGoogleGenerativeAIMessages(
|
|
|
413
421
|
|
|
414
422
|
return {
|
|
415
423
|
functionCall: {
|
|
416
|
-
...(part.toolCallId != null
|
|
424
|
+
...(includeFunctionCallIds && part.toolCallId != null
|
|
417
425
|
? { id: part.toolCallId }
|
|
418
426
|
: {}),
|
|
419
427
|
name: part.toolName,
|
|
@@ -510,6 +518,7 @@ export function convertToGoogleGenerativeAIMessages(
|
|
|
510
518
|
part.toolName,
|
|
511
519
|
output.value,
|
|
512
520
|
part.toolCallId,
|
|
521
|
+
includeFunctionCallIds,
|
|
513
522
|
);
|
|
514
523
|
} else {
|
|
515
524
|
appendLegacyToolResultParts(
|
|
@@ -517,12 +526,15 @@ export function convertToGoogleGenerativeAIMessages(
|
|
|
517
526
|
part.toolName,
|
|
518
527
|
output.value,
|
|
519
528
|
part.toolCallId,
|
|
529
|
+
includeFunctionCallIds,
|
|
520
530
|
);
|
|
521
531
|
}
|
|
522
532
|
} else {
|
|
523
533
|
parts.push({
|
|
524
534
|
functionResponse: {
|
|
525
|
-
...(part.toolCallId != null
|
|
535
|
+
...(includeFunctionCallIds && part.toolCallId != null
|
|
536
|
+
? { id: part.toolCallId }
|
|
537
|
+
: {}),
|
|
526
538
|
name: part.toolName,
|
|
527
539
|
response: {
|
|
528
540
|
name: part.toolName,
|
|
@@ -240,6 +240,7 @@ export class GoogleGenerativeAILanguageModel implements LanguageModelV3 {
|
|
|
240
240
|
providerOptionsName,
|
|
241
241
|
supportsFunctionResponseParts: usesGemini3Features,
|
|
242
242
|
onWarning: warning => warnings.push(warning),
|
|
243
|
+
includeFunctionCallIds: !isVertexProvider,
|
|
243
244
|
},
|
|
244
245
|
);
|
|
245
246
|
|