@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.101
4
+
5
+ ### Patch Changes
6
+
7
+ - 326887b: fix(google): omit unsupported function call IDs
8
+
3
9
  ## 3.0.100
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
30
30
  var import_provider_utils23 = require("@ai-sdk/provider-utils");
31
31
 
32
32
  // src/version.ts
33
- var VERSION = true ? "3.0.100" : "0.0.0-test";
33
+ var VERSION = true ? "3.0.101" : "0.0.0-test";
34
34
 
35
35
  // src/google-generative-ai-embedding-model.ts
36
36
  var import_provider = require("@ai-sdk/provider");
@@ -446,7 +446,7 @@ function convertUrlToolResultPart(url) {
446
446
  }
447
447
  };
448
448
  }
449
- function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
449
+ function appendToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true) {
450
450
  const functionResponseParts = [];
451
451
  const responseTextParts = [];
452
452
  for (const contentPart of outputValue) {
@@ -485,7 +485,7 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
485
485
  }
486
486
  parts.push({
487
487
  functionResponse: {
488
- ...toolCallId != null ? { id: toolCallId } : {},
488
+ ...includeFunctionCallIds && toolCallId != null ? { id: toolCallId } : {},
489
489
  name: toolName,
490
490
  response: {
491
491
  name: toolName,
@@ -495,13 +495,13 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId) {
495
495
  }
496
496
  });
497
497
  }
498
- function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId) {
498
+ function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true) {
499
499
  for (const contentPart of outputValue) {
500
500
  switch (contentPart.type) {
501
501
  case "text":
502
502
  parts.push({
503
503
  functionResponse: {
504
- ...toolCallId != null ? { id: toolCallId } : {},
504
+ ...includeFunctionCallIds && toolCallId != null ? { id: toolCallId } : {},
505
505
  name: toolName,
506
506
  response: {
507
507
  name: toolName,
@@ -533,7 +533,7 @@ function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId) {
533
533
  }
534
534
  }
535
535
  function convertToGoogleGenerativeAIMessages(prompt, options) {
536
- var _a, _b, _c, _d, _e;
536
+ var _a, _b, _c, _d, _e, _f;
537
537
  const systemInstructionParts = [];
538
538
  const contents = [];
539
539
  let systemMessagesAllowed = true;
@@ -542,6 +542,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
542
542
  const providerOptionsName = (_c = options == null ? void 0 : options.providerOptionsName) != null ? _c : "google";
543
543
  const supportsFunctionResponseParts = (_d = options == null ? void 0 : options.supportsFunctionResponseParts) != null ? _d : true;
544
544
  const onWarning = options == null ? void 0 : options.onWarning;
545
+ const includeFunctionCallIds = (_e = options == null ? void 0 : options.includeFunctionCallIds) != null ? _e : true;
545
546
  let sentinelInjected = false;
546
547
  const missingSignatureToolNames = [];
547
548
  const injectSkipSignature = (toolName) => {
@@ -658,7 +659,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
658
659
  }
659
660
  return {
660
661
  functionCall: {
661
- ...part.toolCallId != null ? { id: part.toolCallId } : {},
662
+ ...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
662
663
  name: part.toolName,
663
664
  args: part.input
664
665
  },
@@ -722,24 +723,26 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
722
723
  parts,
723
724
  part.toolName,
724
725
  output.value,
725
- part.toolCallId
726
+ part.toolCallId,
727
+ includeFunctionCallIds
726
728
  );
727
729
  } else {
728
730
  appendLegacyToolResultParts(
729
731
  parts,
730
732
  part.toolName,
731
733
  output.value,
732
- part.toolCallId
734
+ part.toolCallId,
735
+ includeFunctionCallIds
733
736
  );
734
737
  }
735
738
  } else {
736
739
  parts.push({
737
740
  functionResponse: {
738
- ...part.toolCallId != null ? { id: part.toolCallId } : {},
741
+ ...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
739
742
  name: part.toolName,
740
743
  response: {
741
744
  name: part.toolName,
742
- content: output.type === "execution-denied" ? (_e = output.reason) != null ? _e : "Tool call execution denied." : output.value
745
+ content: output.type === "execution-denied" ? (_f = output.reason) != null ? _f : "Tool call execution denied." : output.value
743
746
  }
744
747
  }
745
748
  });
@@ -1611,7 +1614,8 @@ var GoogleGenerativeAILanguageModel = class {
1611
1614
  isGemini3Model: usesGemini3Features,
1612
1615
  providerOptionsName,
1613
1616
  supportsFunctionResponseParts: usesGemini3Features,
1614
- onWarning: (warning) => warnings.push(warning)
1617
+ onWarning: (warning) => warnings.push(warning),
1618
+ includeFunctionCallIds: !isVertexProvider
1615
1619
  }
1616
1620
  );
1617
1621
  const {