@ai-sdk/google 4.0.90 → 4.0.92

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,19 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 4.0.92
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [9184a35]
8
+ - @ai-sdk/provider@4.0.25
9
+ - @ai-sdk/provider-utils@5.0.57
10
+
11
+ ## 4.0.91
12
+
13
+ ### Patch Changes
14
+
15
+ - 32ff7ad: Preserve tool errors in OpenAI Chat Completions and Responses by wrapping their payloads in an `error` object. Send Google tool errors and denied executions under `functionResponse.response.error`.
16
+
3
17
  ## 4.0.90
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import { Experimental_DecisionLanguageModel } from "@ai-sdk/provider-utils/exper
3
3
  import { AISDKError, InvalidArgumentError, InvalidResponseDataError, TooManyEmbeddingValuesForCallError, UnsupportedFunctionalityError } from "@ai-sdk/provider";
4
4
  import { z } from "zod/v4";
5
5
  //#region src/version.ts
6
- const VERSION = "4.0.90";
6
+ const VERSION = "4.0.92";
7
7
  //#endregion
8
8
  //#region src/google-error.ts
9
9
  const googleErrorDataSchema = lazySchema(() => zodSchema(z.object({ error: z.object({
@@ -551,14 +551,17 @@ function convertToGoogleMessages(prompt, options) {
551
551
  if (output.type === "content") {
552
552
  if (supportsFunctionResponseParts) appendToolResultParts(parts, part.toolName, output.value, part.toolCallId, includeFunctionCallIds, supportedFunctionResponseUrls);
553
553
  else appendLegacyToolResultParts(parts, part.toolName, output.value, part.toolCallId, includeFunctionCallIds);
554
- } else parts.push({ functionResponse: {
555
- ...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
556
- name: part.toolName,
557
- response: {
554
+ } else {
555
+ const isError = output.type === "error-text" || output.type === "error-json" || output.type === "execution-denied";
556
+ parts.push({ functionResponse: {
557
+ ...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
558
558
  name: part.toolName,
559
- content: output.type === "execution-denied" ? output.reason ?? "Tool call execution denied." : serializeFunctionResponseContent(output.value)
560
- }
561
- } });
559
+ response: {
560
+ name: part.toolName,
561
+ ...isError ? { error: output.type === "execution-denied" ? output.reason ?? "Tool call execution denied." : serializeFunctionResponseContent(output.value) } : { content: serializeFunctionResponseContent(output.value) }
562
+ }
563
+ } });
564
+ }
562
565
  }
563
566
  contents.push({
564
567
  role: "user",