@ai-sdk/google 4.0.104 → 4.0.105

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.105
4
+
5
+ ### Patch Changes
6
+
7
+ - e729d58: chore(docs): update `README.md` for consistent format and to avoid duplication
8
+ - bbe2bd1: fix(google): keep empty arrays and objects in tool-call input streamed with `streamFunctionCallArguments`
9
+
10
+ Vertex sends a value-less `partialArgs` entry for an empty container (e.g. `$.tags[]`), which was dropped, so `[]` and `{}` arguments went missing from the streamed tool-call input.
11
+
12
+ - Updated dependencies [5475347]
13
+ - Updated dependencies [e729d58]
14
+ - @ai-sdk/provider@4.0.34
15
+ - @ai-sdk/provider-utils@5.0.68
16
+
3
17
  ## 4.0.104
4
18
 
5
19
  ### Patch Changes
package/README.md CHANGED
@@ -6,10 +6,8 @@ The **[Google provider](https://ai-sdk.dev/providers/ai-sdk-providers/google)**
6
6
 
7
7
  ## Setup
8
8
 
9
- The Google provider is available in the `@ai-sdk/google` module. You can install it with
10
-
11
9
  ```bash
12
- npm i @ai-sdk/google
10
+ npm i ai @ai-sdk/google
13
11
  ```
14
12
 
15
13
  ## Skill for Coding Agents
@@ -20,15 +18,7 @@ If you use coding agents such as Claude Code or Cursor, we highly recommend addi
20
18
  npx skills add vercel/ai
21
19
  ```
22
20
 
23
- ## Provider Instance
24
-
25
- You can import the default provider instance `google` from `@ai-sdk/google`:
26
-
27
- ```ts
28
- import { google } from '@ai-sdk/google';
29
- ```
30
-
31
- ## Example
21
+ ## Usage
32
22
 
33
23
  ```ts
34
24
  import { google } from '@ai-sdk/google';
@@ -40,6 +30,4 @@ const { text } = await generateText({
40
30
  });
41
31
  ```
42
32
 
43
- ## Documentation
44
-
45
- Please check out the **[Google provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/google)** for more information.
33
+ See the [Google Provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/google) for more information.
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.104";
6
+ const VERSION = "4.0.105";
7
7
  //#endregion
8
8
  //#region src/google-error.ts
9
9
  const getGoogleErrorSchema = () => z.object({
@@ -1224,8 +1224,9 @@ var GoogleJSONAccumulator = class {
1224
1224
  processPartialArgs(partialArgs) {
1225
1225
  let delta = "";
1226
1226
  for (const arg of partialArgs) {
1227
- const rawPath = arg.jsonPath.replace(/^\$\./, "");
1228
- if (!rawPath) continue;
1227
+ const isArrayTerminator = arg.jsonPath.endsWith("[]");
1228
+ const rawPath = (isArrayTerminator ? arg.jsonPath.slice(0, -2) : arg.jsonPath).replace(/^\$\./, "");
1229
+ if (!rawPath || rawPath === "$") continue;
1229
1230
  const segments = parsePath(rawPath);
1230
1231
  const existingValue = getNestedValue(this.accumulatedArgs, segments);
1231
1232
  if (arg.stringValue != null && existingValue !== void 0) {
@@ -1235,7 +1236,12 @@ var GoogleJSONAccumulator = class {
1235
1236
  continue;
1236
1237
  }
1237
1238
  const resolved = resolvePartialArgValue(arg);
1238
- if (resolved == null) continue;
1239
+ if (resolved == null) {
1240
+ if (existingValue !== void 0 || arg.willContinue === true) continue;
1241
+ setNestedValue(this.accumulatedArgs, segments, isArrayTerminator ? [] : {});
1242
+ delta += this.emitContainer(segments, isArrayTerminator);
1243
+ continue;
1244
+ }
1239
1245
  setNestedValue(this.accumulatedArgs, segments, resolved.value);
1240
1246
  delta += this.emitNavigationTo(segments, arg, resolved.json);
1241
1247
  }
@@ -1294,6 +1300,26 @@ var GoogleJSONAccumulator = class {
1294
1300
  return fragment;
1295
1301
  }
1296
1302
  /**
1303
+ * Navigates to `targetSegments` and opens a container there. The container
1304
+ * stays open so later entries for its children continue inside it; it is
1305
+ * closed by subsequent navigation or by `finalize()`.
1306
+ *
1307
+ * Input: targetSegments=["nested","tags"], isArray=true
1308
+ * Output: '{"nested":{"tags":['
1309
+ */
1310
+ emitContainer(targetSegments, isArray) {
1311
+ let fragment = "";
1312
+ if (this.stringOpen) {
1313
+ fragment += "\"";
1314
+ this.stringOpen = false;
1315
+ }
1316
+ fragment += this.ensureRoot();
1317
+ const commonDepth = this.findCommonStackDepth(targetSegments);
1318
+ fragment += this.closeDownTo(commonDepth);
1319
+ fragment += this.openDownTo(targetSegments, isArray ? 0 : "");
1320
+ return fragment;
1321
+ }
1322
+ /**
1297
1323
  * Returns the stack depth to preserve when navigating to a new target
1298
1324
  * container path. Always >= 1 (the root is never popped).
1299
1325
  *