@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 4.0.24
4
+
5
+ ### Patch Changes
6
+
7
+ - c57a353: fix(google): omit unsupported function call IDs
8
+
3
9
  ## 4.0.23
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "4.0.23" : "0.0.0-test";
10
+ var VERSION = true ? "4.0.24" : "0.0.0-test";
11
11
 
12
12
  // src/google-embedding-model.ts
13
13
  import {
@@ -461,7 +461,7 @@ function convertUrlToolResultPart(url) {
461
461
  }
462
462
  };
463
463
  }
464
- function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
464
+ function appendToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true) {
465
465
  const functionResponseParts = [];
466
466
  const responseTextParts = [];
467
467
  for (const contentPart of outputValue) {
@@ -500,7 +500,7 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
500
500
  }
501
501
  parts.push({
502
502
  functionResponse: {
503
- ...toolCallId != null ? { id: toolCallId } : {},
503
+ ...includeFunctionCallIds && toolCallId != null ? { id: toolCallId } : {},
504
504
  name: toolName,
505
505
  response: {
506
506
  name: toolName,
@@ -510,13 +510,13 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
510
510
  }
511
511
  });
512
512
  }
513
- function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId) {
513
+ function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true) {
514
514
  for (const contentPart of outputValue) {
515
515
  switch (contentPart.type) {
516
516
  case "text":
517
517
  parts.push({
518
518
  functionResponse: {
519
- ...toolCallId != null ? { id: toolCallId } : {},
519
+ ...includeFunctionCallIds && toolCallId != null ? { id: toolCallId } : {},
520
520
  name: toolName,
521
521
  response: {
522
522
  name: toolName,
@@ -551,7 +551,7 @@ function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId) {
551
551
  }
552
552
  }
553
553
  function convertToGoogleMessages(prompt, options) {
554
- var _a, _b, _c, _d, _e;
554
+ var _a, _b, _c, _d, _e, _f;
555
555
  const systemInstructionParts = [];
556
556
  const contents = [];
557
557
  let systemMessagesAllowed = true;
@@ -561,6 +561,7 @@ function convertToGoogleMessages(prompt, options) {
561
561
  const providerOptionsNames = (_c = options == null ? void 0 : options.providerOptionsNames) != null ? _c : ["google"];
562
562
  const isVertexLike = !providerOptionsNames.includes("google");
563
563
  const supportsFunctionResponseParts = (_d = options == null ? void 0 : options.supportsFunctionResponseParts) != null ? _d : true;
564
+ const includeFunctionCallIds = (_e = options == null ? void 0 : options.includeFunctionCallIds) != null ? _e : true;
564
565
  let sentinelInjected = false;
565
566
  const missingSignatureToolNames = [];
566
567
  const injectSkipSignature = (toolName) => {
@@ -774,7 +775,7 @@ function convertToGoogleMessages(prompt, options) {
774
775
  }
775
776
  return {
776
777
  functionCall: {
777
- ...part.toolCallId != null ? { id: part.toolCallId } : {},
778
+ ...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
778
779
  name: part.toolName,
779
780
  args: part.input
780
781
  },
@@ -835,24 +836,26 @@ function convertToGoogleMessages(prompt, options) {
835
836
  parts,
836
837
  part.toolName,
837
838
  output.value,
838
- part.toolCallId
839
+ part.toolCallId,
840
+ includeFunctionCallIds
839
841
  );
840
842
  } else {
841
843
  appendLegacyToolResultParts(
842
844
  parts,
843
845
  part.toolName,
844
846
  output.value,
845
- part.toolCallId
847
+ part.toolCallId,
848
+ includeFunctionCallIds
846
849
  );
847
850
  }
848
851
  } else {
849
852
  parts.push({
850
853
  functionResponse: {
851
- ...part.toolCallId != null ? { id: part.toolCallId } : {},
854
+ ...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
852
855
  name: part.toolName,
853
856
  response: {
854
857
  name: part.toolName,
855
- content: output.type === "execution-denied" ? (_e = output.reason) != null ? _e : "Tool call execution denied." : output.value
858
+ content: output.type === "execution-denied" ? (_f = output.reason) != null ? _f : "Tool call execution denied." : output.value
856
859
  }
857
860
  }
858
861
  });
@@ -1745,7 +1748,8 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1745
1748
  isGemini3Model: usesGemini3Features,
1746
1749
  onWarning: (warning) => warnings.push(warning),
1747
1750
  providerOptionsNames,
1748
- supportsFunctionResponseParts: usesGemini3Features
1751
+ supportsFunctionResponseParts: usesGemini3Features,
1752
+ includeFunctionCallIds: !isVertexProvider
1749
1753
  });
1750
1754
  const {
1751
1755
  tools: googleTools2,