@ai-sdk/google 4.0.90 → 4.0.91

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google",
3
- "version": "4.0.90",
3
+ "version": "4.0.91",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -689,6 +689,10 @@ export function convertToGoogleMessages(
689
689
  );
690
690
  }
691
691
  } else {
692
+ const isError =
693
+ output.type === 'error-text' ||
694
+ output.type === 'error-json' ||
695
+ output.type === 'execution-denied';
692
696
  parts.push({
693
697
  functionResponse: {
694
698
  ...(includeFunctionCallIds && part.toolCallId != null
@@ -697,10 +701,16 @@ export function convertToGoogleMessages(
697
701
  name: part.toolName,
698
702
  response: {
699
703
  name: part.toolName,
700
- content:
701
- output.type === 'execution-denied'
702
- ? (output.reason ?? 'Tool call execution denied.')
703
- : serializeFunctionResponseContent(output.value),
704
+ ...(isError
705
+ ? {
706
+ error:
707
+ output.type === 'execution-denied'
708
+ ? (output.reason ?? 'Tool call execution denied.')
709
+ : serializeFunctionResponseContent(output.value),
710
+ }
711
+ : {
712
+ content: serializeFunctionResponseContent(output.value),
713
+ }),
704
714
  },
705
715
  },
706
716
  });