@ai-sdk/google 4.0.65 → 4.0.66

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,13 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 4.0.66
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [912fb01]
8
+ - @ai-sdk/provider@4.0.12
9
+ - @ai-sdk/provider-utils@5.0.38
10
+
3
11
  ## 4.0.65
4
12
 
5
13
  ### 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.65" : "0.0.0-test";
10
+ var VERSION = true ? "4.0.66" : "0.0.0-test";
11
11
 
12
12
  // src/google-embedding-model.ts
13
13
  import {
@@ -1065,65 +1065,16 @@ The following Zod features are known to not work with Google:
1065
1065
  available provider model ID as a string if needed.
1066
1066
  </Note>
1067
1067
 
1068
- ### Text Batches
1068
+ ### Batch
1069
1069
 
1070
1070
  <Note type="warning">
1071
- Text batch support is experimental and the API may change in patch releases.
1071
+ Batch support is experimental and the API may change in patch releases.
1072
1072
  </Note>
1073
1073
 
1074
- The Google provider supports asynchronous text generation through the
1075
- [Gemini Batch API](https://ai.google.dev/gemini-api/docs/batch-api). Use the
1076
- experimental text batch APIs to start a batch, poll its status, and stream its
1077
- results:
1078
-
1079
- ```ts
1080
- import { google } from '@ai-sdk/google';
1081
- import {
1082
- experimental_getBatchResults as getBatchResults,
1083
- experimental_getBatchStatus as getBatchStatus,
1084
- experimental_startBatch as startBatch,
1085
- } from 'ai';
1086
- import { setTimeout } from 'node:timers/promises';
1087
-
1088
- const model = 'gemini-3.6-flash';
1089
-
1090
- const batch = await startBatch({
1091
- provider: google,
1092
- requests: [
1093
- {
1094
- id: 'capital-france',
1095
- type: 'text',
1096
- model,
1097
- prompt: 'What is the capital of France?',
1098
- },
1099
- {
1100
- id: 'capital-germany',
1101
- type: 'text',
1102
- model,
1103
- prompt: 'What is the capital of Germany?',
1104
- },
1105
- ],
1106
- });
1107
-
1108
- let status = batch.status;
1109
- while (status === 'pending') {
1110
- await setTimeout(60_000);
1111
- ({ status } = await getBatchStatus({ provider: google, batch }));
1112
- }
1113
-
1114
- for await (const item of getBatchResults({ provider: google, batch })) {
1115
- if (item.status === 'succeeded') {
1116
- console.log(item.id, item.text);
1117
- } else {
1118
- console.error(item.id, item.error);
1119
- }
1120
- }
1121
- ```
1122
-
1123
- `startBatch` returns a serializable batch reference. Persist this reference
1124
- to check the batch status or retrieve its results from another process. Results
1125
- can arrive in a different order from the input requests, so match each result by
1126
- its `id`.
1074
+ The Google provider supports asynchronous text generation through the [Gemini
1075
+ Batch API](https://ai.google.dev/gemini-api/docs/batch-api). Pass the Google
1076
+ provider to the AI SDK's [Batch](/docs/ai-sdk-core/batch)
1077
+ API for the complete workflow, including polling, persistence, and result handling.
1127
1078
 
1128
1079
  Each request specifies its `type` and `model`. Google requires every text
1129
1080
  request in a batch to use the same model and throws before submission when the
@@ -1134,6 +1085,11 @@ models differ.
1134
1085
  You can pass a `webhookUrl` to receive a notification when the batch reaches a terminal state:
1135
1086
 
1136
1087
  ```ts
1088
+ import { google } from '@ai-sdk/google';
1089
+ import { experimental_startBatch as startBatch } from 'ai';
1090
+
1091
+ const model = 'gemini-3.6-flash';
1092
+
1137
1093
  const batch = await startBatch({
1138
1094
  provider: google,
1139
1095
  requests: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google",
3
- "version": "4.0.65",
3
+ "version": "4.0.66",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -35,8 +35,8 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@ai-sdk/provider": "4.0.11",
39
- "@ai-sdk/provider-utils": "5.0.37"
38
+ "@ai-sdk/provider": "4.0.12",
39
+ "@ai-sdk/provider-utils": "5.0.38"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@ai-sdk/test-server": "2.0.1",