@ai-sdk/google 4.0.0-canary.56 → 4.0.0-canary.57
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 +7 -1
- package/dist/index.js +1 -1
- package/docs/15-google.mdx +24 -50
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 4.0.0-canary.57
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [ca39020]
|
|
8
|
+
- @ai-sdk/provider-utils@5.0.0-canary.36
|
|
9
|
+
|
|
3
10
|
## 4.0.0-canary.56
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -1788,7 +1795,6 @@
|
|
|
1788
1795
|
### Patch Changes
|
|
1789
1796
|
|
|
1790
1797
|
- 2e06f14: feat (provider/google): Change to provider defined tools
|
|
1791
|
-
|
|
1792
1798
|
- Change the google search tool to be a provider defined tool
|
|
1793
1799
|
- Added new URL context tool as a provider defined tool
|
|
1794
1800
|
|
package/dist/index.js
CHANGED
package/docs/15-google.mdx
CHANGED
|
@@ -149,11 +149,9 @@ The following optional provider options are available for Google models:
|
|
|
149
149
|
- **safetySettings** _Array\<\{ category: string; threshold: string \}\>_
|
|
150
150
|
|
|
151
151
|
Optional. Safety settings for the model.
|
|
152
|
-
|
|
153
152
|
- **category** _string_
|
|
154
153
|
|
|
155
154
|
The category of the safety setting. Can be one of the following:
|
|
156
|
-
|
|
157
155
|
- `HARM_CATEGORY_UNSPECIFIED`
|
|
158
156
|
- `HARM_CATEGORY_HATE_SPEECH`
|
|
159
157
|
- `HARM_CATEGORY_DANGEROUS_CONTENT`
|
|
@@ -164,7 +162,6 @@ The following optional provider options are available for Google models:
|
|
|
164
162
|
- **threshold** _string_
|
|
165
163
|
|
|
166
164
|
The threshold of the safety setting. Can be one of the following:
|
|
167
|
-
|
|
168
165
|
- `HARM_BLOCK_THRESHOLD_UNSPECIFIED`
|
|
169
166
|
- `BLOCK_LOW_AND_ABOVE`
|
|
170
167
|
- `BLOCK_MEDIUM_AND_ABOVE`
|
|
@@ -178,7 +175,6 @@ The following optional provider options are available for Google models:
|
|
|
178
175
|
- **thinkingConfig** _\{ thinkingLevel?: 'minimal' | 'low' | 'medium' | 'high'; thinkingBudget?: number; includeThoughts?: boolean \}_
|
|
179
176
|
|
|
180
177
|
Optional. Configuration for the model's thinking process. Only supported by specific [Google models](https://ai.google.dev/gemini-api/docs/thinking).
|
|
181
|
-
|
|
182
178
|
- **thinkingLevel** _'minimal' | 'low' | 'medium' | 'high'_
|
|
183
179
|
|
|
184
180
|
Optional. Controls the thinking depth for Gemini 3 models. Gemini 3.1 Pro supports 'low', 'medium', and 'high', Gemini 3 Pro supports 'low' and 'high', while Gemini 3 Flash supports all four levels: 'minimal', 'low', 'medium', and 'high'. Only supported by Gemini 3 models.
|
|
@@ -200,11 +196,9 @@ The following optional provider options are available for Google models:
|
|
|
200
196
|
- **imageConfig** _\{ aspectRatio?: string, imageSize?: string \}_
|
|
201
197
|
|
|
202
198
|
Optional. Configuration for the models image generation. Only supported by specific [Google models](https://ai.google.dev/gemini-api/docs/image-generation).
|
|
203
|
-
|
|
204
199
|
- **aspectRatio** _string_
|
|
205
200
|
|
|
206
201
|
Model defaults to generate 1:1 squares, or to matching the output image size to that of your input image. Can be one of the following:
|
|
207
|
-
|
|
208
202
|
- 1:1
|
|
209
203
|
- 2:3
|
|
210
204
|
- 3:2
|
|
@@ -219,7 +213,6 @@ The following optional provider options are available for Google models:
|
|
|
219
213
|
- **imageSize** _string_
|
|
220
214
|
|
|
221
215
|
Controls the output image resolution. Defaults to 1K. Can be one of the following:
|
|
222
|
-
|
|
223
216
|
- 1K
|
|
224
217
|
- 2K
|
|
225
218
|
- 4K
|
|
@@ -232,7 +225,6 @@ The following optional provider options are available for Google models:
|
|
|
232
225
|
- **mediaResolution** _string_
|
|
233
226
|
|
|
234
227
|
Optional. If specified, the media resolution specified will be used. Can be one of the following:
|
|
235
|
-
|
|
236
228
|
- `MEDIA_RESOLUTION_UNSPECIFIED`
|
|
237
229
|
- `MEDIA_RESOLUTION_LOW`
|
|
238
230
|
- `MEDIA_RESOLUTION_MEDIUM`
|
|
@@ -531,9 +523,7 @@ const { text, sources, providerMetadata } = await generateText({
|
|
|
531
523
|
|
|
532
524
|
// access the grounding metadata. Casting to the provider metadata type
|
|
533
525
|
// is optional but provides autocomplete and type safety.
|
|
534
|
-
const metadata = providerMetadata?.google as
|
|
535
|
-
| GoogleProviderMetadata
|
|
536
|
-
| undefined;
|
|
526
|
+
const metadata = providerMetadata?.google as GoogleProviderMetadata | undefined;
|
|
537
527
|
const groundingMetadata = metadata?.groundingMetadata;
|
|
538
528
|
const safetyRatings = metadata?.safetyRatings;
|
|
539
529
|
```
|
|
@@ -543,14 +533,12 @@ The `googleSearch` tool accepts the following optional configuration options:
|
|
|
543
533
|
- **searchTypes** _object_
|
|
544
534
|
|
|
545
535
|
Enables specific search types. Both can be combined.
|
|
546
|
-
|
|
547
536
|
- `webSearch`: Enable web search grounding (pass `{}` to enable). This is the default.
|
|
548
537
|
- `imageSearch`: Enable [image search grounding](https://ai.google.dev/gemini-api/docs/image-generation#image-search) (pass `{}` to enable).
|
|
549
538
|
|
|
550
539
|
- **timeRangeFilter** _object_
|
|
551
540
|
|
|
552
541
|
Restricts search results to a specific time range. Both `startTime` and `endTime` are required.
|
|
553
|
-
|
|
554
542
|
- `startTime`: Start time in ISO 8601 format (e.g. `'2025-01-01T00:00:00Z'`).
|
|
555
543
|
- `endTime`: End time in ISO 8601 format (e.g. `'2025-12-31T23:59:59Z'`).
|
|
556
544
|
|
|
@@ -569,12 +557,10 @@ When Google Search grounding is enabled, the model will include sources in the r
|
|
|
569
557
|
Additionally, the grounding metadata includes detailed information about how search results were used to ground the model's response. Here are the available fields:
|
|
570
558
|
|
|
571
559
|
- **`webSearchQueries`** (`string[] | null`)
|
|
572
|
-
|
|
573
560
|
- Array of search queries used to retrieve information
|
|
574
561
|
- Example: `["What's the weather in Chicago this weekend?"]`
|
|
575
562
|
|
|
576
563
|
- **`searchEntryPoint`** (`{ renderedContent: string } | null`)
|
|
577
|
-
|
|
578
564
|
- Contains the main search result content used as an entry point
|
|
579
565
|
- The `renderedContent` field contains the formatted content
|
|
580
566
|
|
|
@@ -692,9 +678,7 @@ const { text, sources, providerMetadata } = await generateText({
|
|
|
692
678
|
},
|
|
693
679
|
});
|
|
694
680
|
|
|
695
|
-
const metadata = providerMetadata?.google as
|
|
696
|
-
| GoogleProviderMetadata
|
|
697
|
-
| undefined;
|
|
681
|
+
const metadata = providerMetadata?.google as GoogleProviderMetadata | undefined;
|
|
698
682
|
const groundingMetadata = metadata?.groundingMetadata;
|
|
699
683
|
const urlContextMetadata = metadata?.urlContextMetadata;
|
|
700
684
|
```
|
|
@@ -702,7 +686,6 @@ const urlContextMetadata = metadata?.urlContextMetadata;
|
|
|
702
686
|
The URL context metadata includes detailed information about how the model used the URL context to generate the response. Here are the available fields:
|
|
703
687
|
|
|
704
688
|
- **`urlMetadata`** (`{ retrievedUrl: string; urlRetrievalStatus: string; }[] | null`)
|
|
705
|
-
|
|
706
689
|
- Array of URL context metadata
|
|
707
690
|
- Each object includes:
|
|
708
691
|
- **`retrievedUrl`**: The URL of the context
|
|
@@ -774,9 +757,7 @@ const { text, sources, providerMetadata } = await generateText({
|
|
|
774
757
|
},
|
|
775
758
|
});
|
|
776
759
|
|
|
777
|
-
const metadata = providerMetadata?.google as
|
|
778
|
-
| GoogleProviderMetadata
|
|
779
|
-
| undefined;
|
|
760
|
+
const metadata = providerMetadata?.google as GoogleProviderMetadata | undefined;
|
|
780
761
|
const groundingMetadata = metadata?.groundingMetadata;
|
|
781
762
|
const urlContextMetadata = metadata?.urlContextMetadata;
|
|
782
763
|
```
|
|
@@ -807,9 +788,7 @@ const { text, sources, providerMetadata } = await generateText({
|
|
|
807
788
|
'What are the best Italian restaurants within a 15-minute walk from here?',
|
|
808
789
|
});
|
|
809
790
|
|
|
810
|
-
const metadata = providerMetadata?.google as
|
|
811
|
-
| GoogleProviderMetadata
|
|
812
|
-
| undefined;
|
|
791
|
+
const metadata = providerMetadata?.google as GoogleProviderMetadata | undefined;
|
|
813
792
|
const groundingMetadata = metadata?.groundingMetadata;
|
|
814
793
|
```
|
|
815
794
|
|
|
@@ -872,9 +851,7 @@ const { text, sources, providerMetadata } = await generateText({
|
|
|
872
851
|
|
|
873
852
|
// access the grounding metadata. Casting to the provider metadata type
|
|
874
853
|
// is optional but provides autocomplete and type safety.
|
|
875
|
-
const metadata = providerMetadata?.google as
|
|
876
|
-
| GoogleProviderMetadata
|
|
877
|
-
| undefined;
|
|
854
|
+
const metadata = providerMetadata?.google as GoogleProviderMetadata | undefined;
|
|
878
855
|
const groundingMetadata = metadata?.groundingMetadata;
|
|
879
856
|
const safetyRatings = metadata?.safetyRatings;
|
|
880
857
|
```
|
|
@@ -884,7 +861,6 @@ When RAG Engine Grounding is enabled, the model will include sources from your R
|
|
|
884
861
|
Additionally, the grounding metadata includes detailed information about how RAG results were used to ground the model's response. Here are the available fields:
|
|
885
862
|
|
|
886
863
|
- **`groundingChunks`** (Array of chunk objects | null)
|
|
887
|
-
|
|
888
864
|
- Contains the retrieved context chunks from your RAG corpus
|
|
889
865
|
- Each chunk includes:
|
|
890
866
|
- **`retrievedContext`**: Information about the retrieved context
|
|
@@ -893,7 +869,6 @@ Additionally, the grounding metadata includes detailed information about how RAG
|
|
|
893
869
|
- `text`: The actual text content of the chunk
|
|
894
870
|
|
|
895
871
|
- **`groundingSupports`** (Array of support objects | null)
|
|
896
|
-
|
|
897
872
|
- Contains details about how specific response parts are supported by RAG results
|
|
898
873
|
- Each support object includes:
|
|
899
874
|
- **`segment`**: Information about the grounded text segment
|
|
@@ -937,12 +912,10 @@ Example response:
|
|
|
937
912
|
The `vertexRagStore` tool accepts the following configuration options:
|
|
938
913
|
|
|
939
914
|
- **`ragCorpus`** (`string`, required)
|
|
940
|
-
|
|
941
915
|
- The RagCorpus resource name in the format: `projects/{project}/locations/{location}/ragCorpora/{rag_corpus}`
|
|
942
916
|
- This identifies your specific RAG corpus to search against
|
|
943
917
|
|
|
944
918
|
- **`topK`** (`number`, optional)
|
|
945
|
-
|
|
946
919
|
- The number of top contexts to retrieve from your RAG corpus
|
|
947
920
|
- Defaults to the corpus configuration if not specified
|
|
948
921
|
|
|
@@ -1110,9 +1083,9 @@ a Gemini [agent preset](#agent-presets). The returned model can be passed to
|
|
|
1110
1083
|
|
|
1111
1084
|
<Note>
|
|
1112
1085
|
Use `google(...)` for the standard `:generateContent` /
|
|
1113
|
-
`:streamGenerateContent` endpoints, and `google.interactions(...)` for the
|
|
1114
|
-
|
|
1115
|
-
|
|
1086
|
+
`:streamGenerateContent` endpoints, and `google.interactions(...)` for the new
|
|
1087
|
+
Interactions endpoint. Pick one per model instance — they target different
|
|
1088
|
+
request bodies and SSE event vocabularies.
|
|
1116
1089
|
</Note>
|
|
1117
1090
|
|
|
1118
1091
|
### Provider Options
|
|
@@ -1158,10 +1131,12 @@ The following optional provider options are available:
|
|
|
1158
1131
|
|
|
1159
1132
|
Name of a Gemini agent preset (e.g. `'deep-research-pro-preview-12-2025'`).
|
|
1160
1133
|
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1134
|
+
<Note>
|
|
1135
|
+
|
|
1136
|
+
Prefer the factory form `google.interactions({ agent: '...' })` over
|
|
1137
|
+
setting `agent` in provider options — the factory is type-checked
|
|
1138
|
+
against the supported agent names.
|
|
1139
|
+
|
|
1165
1140
|
</Note>
|
|
1166
1141
|
|
|
1167
1142
|
- **agentConfig** _object_
|
|
@@ -1293,16 +1268,16 @@ const turn2 = await generateText({
|
|
|
1293
1268
|
The Interactions API ships a built-in tool catalog. The provider-defined
|
|
1294
1269
|
tools under `google.tools.*` map onto Interactions tool descriptors:
|
|
1295
1270
|
|
|
1296
|
-
| AI SDK tool
|
|
1297
|
-
|
|
|
1298
|
-
| `google.tools.googleSearch`
|
|
1299
|
-
| `google.tools.codeExecution`
|
|
1300
|
-
| `google.tools.urlContext`
|
|
1301
|
-
| `google.tools.fileSearch`
|
|
1302
|
-
| `google.tools.googleMaps`
|
|
1303
|
-
| _provider tool_ `google.computer_use` | `computer_use` | Computer use (browser environment).
|
|
1304
|
-
| _provider tool_ `google.mcp_server` | `mcp_server` | Remote MCP server passthrough.
|
|
1305
|
-
| _provider tool_ `google.retrieval` | `retrieval` | Vertex AI Search retrieval.
|
|
1271
|
+
| AI SDK tool | Interactions tool type | Notes |
|
|
1272
|
+
| ------------------------------------- | ---------------------- | ----------------------------------------- |
|
|
1273
|
+
| `google.tools.googleSearch` | `google_search` | Web / image search grounding. |
|
|
1274
|
+
| `google.tools.codeExecution` | `code_execution` | Server-side Python execution. |
|
|
1275
|
+
| `google.tools.urlContext` | `url_context` | Fetch URLs referenced in the prompt. |
|
|
1276
|
+
| `google.tools.fileSearch` | `file_search` | Retrieval from File Search stores. |
|
|
1277
|
+
| `google.tools.googleMaps` | `google_maps` | Maps grounding for nearby-places queries. |
|
|
1278
|
+
| _provider tool_ `google.computer_use` | `computer_use` | Computer use (browser environment). |
|
|
1279
|
+
| _provider tool_ `google.mcp_server` | `mcp_server` | Remote MCP server passthrough. |
|
|
1280
|
+
| _provider tool_ `google.retrieval` | `retrieval` | Vertex AI Search retrieval. |
|
|
1306
1281
|
|
|
1307
1282
|
Function tools (`type: 'function'`) defined with the AI SDK `tool(...)`
|
|
1308
1283
|
helper are translated to Interactions `function` tool descriptors. Other
|
|
@@ -1569,7 +1544,6 @@ The following optional provider options are available for Google embedding model
|
|
|
1569
1544
|
- **taskType**: _string_
|
|
1570
1545
|
|
|
1571
1546
|
Optional. Specifies the task type for generating embeddings. Supported task types include:
|
|
1572
|
-
|
|
1573
1547
|
- `SEMANTIC_SIMILARITY`: Optimized for text similarity.
|
|
1574
1548
|
- `CLASSIFICATION`: Optimized for text classification.
|
|
1575
1549
|
- `CLUSTERING`: Optimized for clustering texts based on similarity.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/google",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.57",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@ai-sdk/provider": "4.0.0-canary.16",
|
|
39
|
-
"@ai-sdk/provider-utils": "5.0.0-canary.
|
|
39
|
+
"@ai-sdk/provider-utils": "5.0.0-canary.36"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/node": "20.17.24",
|