@ai-sdk/google 4.0.21 → 4.0.22

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.
@@ -405,6 +405,7 @@ function convertToGoogleMessages(prompt, options) {
405
405
  }
406
406
  case "assistant": {
407
407
  systemMessagesAllowed = false;
408
+ let modelResponseHasSignedFunctionCall = false;
408
409
  contents.push({
409
410
  role: "model",
410
411
  parts: content.map((part) => {
@@ -497,8 +498,19 @@ function convertToGoogleMessages(prompt, options) {
497
498
  case "tool-call": {
498
499
  const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
499
500
  const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
500
- const effectiveThoughtSignature = thoughtSignature != null ? thoughtSignature : isGemini3Model2 ? injectSkipSignature(part.toolName) : void 0;
501
- if (serverToolCallId && serverToolType) {
501
+ const isServerToolCall = serverToolCallId != null && serverToolType != null;
502
+ const shouldSkipMissingSignatureMitigation = (
503
+ // Gemini 3 returns a single signature for a parallel
504
+ // function-call response on the first standard function
505
+ // call. Subsequent standard function calls in the same
506
+ // model response legitimately have no signature.
507
+ !isServerToolCall && thoughtSignature == null && modelResponseHasSignedFunctionCall
508
+ );
509
+ const effectiveThoughtSignature = thoughtSignature != null ? thoughtSignature : isGemini3Model2 && !shouldSkipMissingSignatureMitigation ? injectSkipSignature(part.toolName) : void 0;
510
+ if (!isServerToolCall && thoughtSignature != null) {
511
+ modelResponseHasSignedFunctionCall = true;
512
+ }
513
+ if (isServerToolCall) {
502
514
  return {
503
515
  toolCall: {
504
516
  toolType: serverToolType,