@ai-sdk/google 3.0.97 → 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.
@@ -359,6 +359,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
359
359
  }
360
360
  case "assistant": {
361
361
  systemMessagesAllowed = false;
362
+ let modelResponseHasSignedFunctionCall = false;
362
363
  contents.push({
363
364
  role: "model",
364
365
  parts: content.map((part) => {
@@ -399,8 +400,19 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
399
400
  case "tool-call": {
400
401
  const serverToolCallId = (providerOpts == null ? void 0 : providerOpts.serverToolCallId) != null ? String(providerOpts.serverToolCallId) : void 0;
401
402
  const serverToolType = (providerOpts == null ? void 0 : providerOpts.serverToolType) != null ? String(providerOpts.serverToolType) : void 0;
402
- const effectiveThoughtSignature = thoughtSignature != null ? thoughtSignature : isGemini3Model ? injectSkipSignature(part.toolName) : void 0;
403
- if (serverToolCallId && serverToolType) {
403
+ const isServerToolCall = serverToolCallId != null && serverToolType != null;
404
+ const shouldSkipMissingSignatureMitigation = (
405
+ // Gemini 3 returns a single signature for a parallel
406
+ // function-call response on the first standard function
407
+ // call. Subsequent standard function calls in the same
408
+ // model response legitimately have no signature.
409
+ !isServerToolCall && thoughtSignature == null && modelResponseHasSignedFunctionCall
410
+ );
411
+ const effectiveThoughtSignature = thoughtSignature != null ? thoughtSignature : isGemini3Model && !shouldSkipMissingSignatureMitigation ? injectSkipSignature(part.toolName) : void 0;
412
+ if (!isServerToolCall && thoughtSignature != null) {
413
+ modelResponseHasSignedFunctionCall = true;
414
+ }
415
+ if (isServerToolCall) {
404
416
  return {
405
417
  toolCall: {
406
418
  toolType: serverToolType,