@ai-sdk/google 3.0.98 → 3.0.99
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 +15 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +14 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +14 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/convert-to-google-generative-ai-messages.ts +18 -7
package/package.json
CHANGED
|
@@ -313,6 +313,8 @@ export function convertToGoogleGenerativeAIMessages(
|
|
|
313
313
|
case 'assistant': {
|
|
314
314
|
systemMessagesAllowed = false;
|
|
315
315
|
|
|
316
|
+
let modelResponseHasSignedFunctionCall = false;
|
|
317
|
+
|
|
316
318
|
contents.push({
|
|
317
319
|
role: 'model',
|
|
318
320
|
parts: content
|
|
@@ -375,18 +377,27 @@ export function convertToGoogleGenerativeAIMessages(
|
|
|
375
377
|
providerOpts?.serverToolType != null
|
|
376
378
|
? String(providerOpts.serverToolType)
|
|
377
379
|
: undefined;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
380
|
+
const isServerToolCall =
|
|
381
|
+
serverToolCallId != null && serverToolType != null;
|
|
382
|
+
const shouldSkipMissingSignatureMitigation =
|
|
383
|
+
// Gemini 3 returns a single signature for a parallel
|
|
384
|
+
// function-call response on the first standard function
|
|
385
|
+
// call. Subsequent standard function calls in the same
|
|
386
|
+
// model response legitimately have no signature.
|
|
387
|
+
!isServerToolCall &&
|
|
388
|
+
thoughtSignature == null &&
|
|
389
|
+
modelResponseHasSignedFunctionCall;
|
|
383
390
|
const effectiveThoughtSignature =
|
|
384
391
|
thoughtSignature ??
|
|
385
|
-
(isGemini3Model
|
|
392
|
+
(isGemini3Model && !shouldSkipMissingSignatureMitigation
|
|
386
393
|
? injectSkipSignature(part.toolName)
|
|
387
394
|
: undefined);
|
|
388
395
|
|
|
389
|
-
if (
|
|
396
|
+
if (!isServerToolCall && thoughtSignature != null) {
|
|
397
|
+
modelResponseHasSignedFunctionCall = true;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
if (isServerToolCall) {
|
|
390
401
|
return {
|
|
391
402
|
toolCall: {
|
|
392
403
|
toolType: serverToolType,
|