@ai-sdk/google-vertex 5.0.0-canary.74 → 5.0.0-canary.76
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 +20 -0
- package/dist/anthropic/edge/index.js +1 -1
- package/dist/edge/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/maas/edge/index.js +1 -1
- package/dist/xai/edge/index.js +1 -1
- package/docs/16-google-vertex.mdx +33 -38
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @ai-sdk/google-vertex
|
|
2
2
|
|
|
3
|
+
## 5.0.0-canary.76
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [ca39020]
|
|
8
|
+
- @ai-sdk/provider-utils@5.0.0-canary.36
|
|
9
|
+
- @ai-sdk/anthropic@4.0.0-canary.49
|
|
10
|
+
- @ai-sdk/google@4.0.0-canary.57
|
|
11
|
+
- @ai-sdk/openai-compatible@3.0.0-canary.43
|
|
12
|
+
|
|
13
|
+
## 5.0.0-canary.75
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [f634bac]
|
|
18
|
+
- @ai-sdk/provider-utils@5.0.0-canary.35
|
|
19
|
+
- @ai-sdk/anthropic@4.0.0-canary.48
|
|
20
|
+
- @ai-sdk/google@4.0.0-canary.56
|
|
21
|
+
- @ai-sdk/openai-compatible@3.0.0-canary.42
|
|
22
|
+
|
|
3
23
|
## 5.0.0-canary.74
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "@ai-sdk/provider-utils";
|
|
11
11
|
|
|
12
12
|
// src/version.ts
|
|
13
|
-
var VERSION = true ? "5.0.0-canary.
|
|
13
|
+
var VERSION = true ? "5.0.0-canary.76" : "0.0.0-test";
|
|
14
14
|
|
|
15
15
|
// src/edge/google-vertex-auth-edge.ts
|
|
16
16
|
var loadCredentials = async () => {
|
package/dist/edge/index.js
CHANGED
package/dist/index.js
CHANGED
package/dist/maas/edge/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "@ai-sdk/provider-utils";
|
|
11
11
|
|
|
12
12
|
// src/version.ts
|
|
13
|
-
var VERSION = true ? "5.0.0-canary.
|
|
13
|
+
var VERSION = true ? "5.0.0-canary.76" : "0.0.0-test";
|
|
14
14
|
|
|
15
15
|
// src/edge/google-vertex-auth-edge.ts
|
|
16
16
|
var loadCredentials = async () => {
|
package/dist/xai/edge/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "@ai-sdk/provider-utils";
|
|
11
11
|
|
|
12
12
|
// src/version.ts
|
|
13
|
-
var VERSION = true ? "5.0.0-canary.
|
|
13
|
+
var VERSION = true ? "5.0.0-canary.76" : "0.0.0-test";
|
|
14
14
|
|
|
15
15
|
// src/edge/google-vertex-auth-edge.ts
|
|
16
16
|
var loadCredentials = async () => {
|
|
@@ -100,7 +100,6 @@ You can use the following optional settings to customize the provider instance:
|
|
|
100
100
|
- **googleAuthOptions** _object_
|
|
101
101
|
|
|
102
102
|
Optional. The Authentication options used by the [Google Auth Library](https://github.com/googleapis/google-auth-library-nodejs/). See also the [GoogleAuthOptions](https://github.com/googleapis/google-auth-library-nodejs/blob/08978822e1b7b5961f0e355df51d738e012be392/src/auth/googleauth.ts#L87C18-L87C35) interface.
|
|
103
|
-
|
|
104
103
|
- **authClient** _object_
|
|
105
104
|
An `AuthClient` to use.
|
|
106
105
|
|
|
@@ -128,7 +127,6 @@ You can use the following optional settings to customize the provider instance:
|
|
|
128
127
|
- **headers** _Resolvable<Record<string, string | undefined>>_
|
|
129
128
|
|
|
130
129
|
Headers to include in the requests. Can be provided in multiple formats:
|
|
131
|
-
|
|
132
130
|
- A record of header key-value pairs: `Record<string, string | undefined>`
|
|
133
131
|
- A function that returns headers: `() => Record<string, string | undefined>`
|
|
134
132
|
- An async function that returns headers: `async () => Record<string, string | undefined>`
|
|
@@ -204,7 +202,6 @@ You can use the following optional settings to customize the provider instance:
|
|
|
204
202
|
- **googleCredentials** _object_
|
|
205
203
|
|
|
206
204
|
Optional. The credentials used by the Edge provider for authentication. These credentials are typically set through environment variables and are derived from a service account JSON file.
|
|
207
|
-
|
|
208
205
|
- **clientEmail** _string_
|
|
209
206
|
The client email from the service account JSON file. Defaults to the contents of the `GOOGLE_CLIENT_EMAIL` environment variable.
|
|
210
207
|
|
|
@@ -217,7 +214,6 @@ You can use the following optional settings to customize the provider instance:
|
|
|
217
214
|
- **headers** _Resolvable<Record<string, string | undefined>>_
|
|
218
215
|
|
|
219
216
|
Headers to include in the requests. Can be provided in multiple formats:
|
|
220
|
-
|
|
221
217
|
- A record of header key-value pairs: `Record<string, string | undefined>`
|
|
222
218
|
- A function that returns headers: `() => Record<string, string | undefined>`
|
|
223
219
|
- An async function that returns headers: `async () => Record<string, string | undefined>`
|
|
@@ -310,11 +306,9 @@ The following optional provider options are available for Google Vertex models:
|
|
|
310
306
|
- **safetySettings** _Array\<\{ category: string; threshold: string \}\>_
|
|
311
307
|
|
|
312
308
|
Optional. Safety settings for the model.
|
|
313
|
-
|
|
314
309
|
- **category** _string_
|
|
315
310
|
|
|
316
311
|
The category of the safety setting. Can be one of the following:
|
|
317
|
-
|
|
318
312
|
- `HARM_CATEGORY_UNSPECIFIED`
|
|
319
313
|
- `HARM_CATEGORY_HATE_SPEECH`
|
|
320
314
|
- `HARM_CATEGORY_DANGEROUS_CONTENT`
|
|
@@ -325,7 +319,6 @@ The following optional provider options are available for Google Vertex models:
|
|
|
325
319
|
- **threshold** _string_
|
|
326
320
|
|
|
327
321
|
The threshold of the safety setting. Can be one of the following:
|
|
328
|
-
|
|
329
322
|
- `HARM_BLOCK_THRESHOLD_UNSPECIFIED`
|
|
330
323
|
- `BLOCK_LOW_AND_ABOVE`
|
|
331
324
|
- `BLOCK_MEDIUM_AND_ABOVE`
|
|
@@ -512,8 +505,8 @@ for await (const part of result.fullStream) {
|
|
|
512
505
|
|
|
513
506
|
<Note>
|
|
514
507
|
This feature is only available on the Vertex AI API. It is not supported on
|
|
515
|
-
the Gemini API. When used with the Google provider, a warning
|
|
516
|
-
|
|
508
|
+
the Gemini API. When used with the Google provider, a warning will be emitted
|
|
509
|
+
and the option will be ignored.
|
|
517
510
|
</Note>
|
|
518
511
|
|
|
519
512
|
#### Reasoning (Thinking Tokens)
|
|
@@ -872,7 +865,6 @@ The following optional provider options are available for Google Vertex AI embed
|
|
|
872
865
|
- **taskType**: _string_
|
|
873
866
|
|
|
874
867
|
Optional. Specifies the task type for generating embeddings. Supported task types include:
|
|
875
|
-
|
|
876
868
|
- `SEMANTIC_SIMILARITY`: Optimized for text similarity.
|
|
877
869
|
- `CLASSIFICATION`: Optimized for text classification.
|
|
878
870
|
- `CLUSTERING`: Optimized for clustering texts based on similarity.
|
|
@@ -993,7 +985,10 @@ Google Vertex Imagen models support image editing through inpainting, outpaintin
|
|
|
993
985
|
Insert or replace objects in specific areas using a mask:
|
|
994
986
|
|
|
995
987
|
```ts
|
|
996
|
-
import {
|
|
988
|
+
import {
|
|
989
|
+
googleVertex,
|
|
990
|
+
GoogleVertexImageModelOptions,
|
|
991
|
+
} from '@ai-sdk/google-vertex';
|
|
997
992
|
import { generateImage } from 'ai';
|
|
998
993
|
import fs from 'fs';
|
|
999
994
|
|
|
@@ -1025,7 +1020,10 @@ const { images } = await generateImage({
|
|
|
1025
1020
|
Extend an image beyond its original boundaries:
|
|
1026
1021
|
|
|
1027
1022
|
```ts
|
|
1028
|
-
import {
|
|
1023
|
+
import {
|
|
1024
|
+
googleVertex,
|
|
1025
|
+
GoogleVertexImageModelOptions,
|
|
1026
|
+
} from '@ai-sdk/google-vertex';
|
|
1029
1027
|
import { generateImage } from 'ai';
|
|
1030
1028
|
import fs from 'fs';
|
|
1031
1029
|
|
|
@@ -1056,7 +1054,6 @@ const { images } = await generateImage({
|
|
|
1056
1054
|
The following options are available under `providerOptions.vertex.edit`:
|
|
1057
1055
|
|
|
1058
1056
|
- **mode** - The edit mode to use:
|
|
1059
|
-
|
|
1060
1057
|
- `EDIT_MODE_INPAINT_INSERTION` - Insert objects into masked areas
|
|
1061
1058
|
- `EDIT_MODE_INPAINT_REMOVAL` - Remove objects from masked areas
|
|
1062
1059
|
- `EDIT_MODE_OUTPAINT` - Extend image beyond boundaries
|
|
@@ -1067,7 +1064,6 @@ The following options are available under `providerOptions.vertex.edit`:
|
|
|
1067
1064
|
- **baseSteps** _number_ - Number of sampling steps (35-75). Higher values = better quality but slower.
|
|
1068
1065
|
|
|
1069
1066
|
- **maskMode** - How to interpret the mask:
|
|
1070
|
-
|
|
1071
1067
|
- `MASK_MODE_USER_PROVIDED` - Use the provided mask directly
|
|
1072
1068
|
- `MASK_MODE_DEFAULT` - Default mask mode
|
|
1073
1069
|
- `MASK_MODE_DETECTION_BOX` - Mask from detected bounding boxes
|
|
@@ -1330,7 +1326,6 @@ You can use the following optional settings to customize the Google Vertex Anthr
|
|
|
1330
1326
|
- **googleAuthOptions** _object_
|
|
1331
1327
|
|
|
1332
1328
|
Optional. The Authentication options used by the [Google Auth Library](https://github.com/googleapis/google-auth-library-nodejs/). See also the [GoogleAuthOptions](https://github.com/googleapis/google-auth-library-nodejs/blob/08978822e1b7b5961f0e355df51d738e012be392/src/auth/googleauth.ts#L87C18-L87C35) interface.
|
|
1333
|
-
|
|
1334
1329
|
- **authClient** _object_
|
|
1335
1330
|
An `AuthClient` to use.
|
|
1336
1331
|
|
|
@@ -1358,7 +1353,6 @@ You can use the following optional settings to customize the Google Vertex Anthr
|
|
|
1358
1353
|
- **headers** _Resolvable<Record<string, string | undefined>>_
|
|
1359
1354
|
|
|
1360
1355
|
Headers to include in the requests. Can be provided in multiple formats:
|
|
1361
|
-
|
|
1362
1356
|
- A record of header key-value pairs: `Record<string, string | undefined>`
|
|
1363
1357
|
- A function that returns headers: `() => Record<string, string | undefined>`
|
|
1364
1358
|
- An async function that returns headers: `async () => Record<string, string | undefined>`
|
|
@@ -1421,7 +1415,6 @@ You can use the following optional settings to customize the provider instance:
|
|
|
1421
1415
|
- **googleCredentials** _object_
|
|
1422
1416
|
|
|
1423
1417
|
Optional. The credentials used by the Edge provider for authentication. These credentials are typically set through environment variables and are derived from a service account JSON file.
|
|
1424
|
-
|
|
1425
1418
|
- **clientEmail** _string_
|
|
1426
1419
|
The client email from the service account JSON file. Defaults to the contents of the `GOOGLE_CLIENT_EMAIL` environment variable.
|
|
1427
1420
|
|
|
@@ -1434,7 +1427,6 @@ You can use the following optional settings to customize the provider instance:
|
|
|
1434
1427
|
- **headers** _Resolvable<Record<string, string | undefined>>_
|
|
1435
1428
|
|
|
1436
1429
|
Headers to include in the requests. Can be provided in multiple formats:
|
|
1437
|
-
|
|
1438
1430
|
- A record of header key-value pairs: `Record<string, string | undefined>`
|
|
1439
1431
|
- A function that returns headers: `() => Record<string, string | undefined>`
|
|
1440
1432
|
- An async function that returns headers: `async () => Record<string, string | undefined>`
|
|
@@ -1495,7 +1487,6 @@ The following optional provider options are available for Anthropic models:
|
|
|
1495
1487
|
- `metadata` _object_
|
|
1496
1488
|
|
|
1497
1489
|
Optional. Metadata to include with the request. See the [Anthropic API documentation](https://platform.claude.com/docs/en/api/messages/create) for details.
|
|
1498
|
-
|
|
1499
1490
|
- `userId` _string_ - An external identifier for the end-user.
|
|
1500
1491
|
|
|
1501
1492
|
### Reasoning
|
|
@@ -1570,7 +1561,10 @@ const result = await generateText({
|
|
|
1570
1561
|
});
|
|
1571
1562
|
|
|
1572
1563
|
console.log(result.text);
|
|
1573
|
-
console.log(
|
|
1564
|
+
console.log(
|
|
1565
|
+
'Cache read tokens:',
|
|
1566
|
+
result.usage.inputTokenDetails.cacheReadTokens,
|
|
1567
|
+
);
|
|
1574
1568
|
console.log(
|
|
1575
1569
|
'Cache write tokens:',
|
|
1576
1570
|
result.usage.inputTokenDetails.cacheWriteTokens,
|
|
@@ -1934,7 +1928,7 @@ import { z } from 'zod';
|
|
|
1934
1928
|
|
|
1935
1929
|
const result = await generateText({
|
|
1936
1930
|
model: googleVertexXai('xai/grok-4.1-fast-reasoning'),
|
|
1937
|
-
output: Output.object({
|
|
1931
|
+
output: Output.object({
|
|
1938
1932
|
schema: z.object({
|
|
1939
1933
|
name: z.string(),
|
|
1940
1934
|
date: z.string(),
|
|
@@ -1949,12 +1943,12 @@ const result = await generateText({
|
|
|
1949
1943
|
|
|
1950
1944
|
The following models are available through the Google Vertex xAI provider. You can also pass any valid model ID as a string.
|
|
1951
1945
|
|
|
1952
|
-
| Model ID
|
|
1953
|
-
|
|
|
1954
|
-
| `xai/grok-4.20-reasoning`
|
|
1955
|
-
| `xai/grok-4.20-non-reasoning`
|
|
1956
|
-
| `xai/grok-4.1-fast-reasoning`
|
|
1957
|
-
| `xai/grok-4.1-fast-non-reasoning`
|
|
1946
|
+
| Model ID | Reasoning |
|
|
1947
|
+
| --------------------------------- | --------- |
|
|
1948
|
+
| `xai/grok-4.20-reasoning` | Yes |
|
|
1949
|
+
| `xai/grok-4.20-non-reasoning` | No |
|
|
1950
|
+
| `xai/grok-4.1-fast-reasoning` | Yes |
|
|
1951
|
+
| `xai/grok-4.1-fast-non-reasoning` | No |
|
|
1958
1952
|
|
|
1959
1953
|
<Note>
|
|
1960
1954
|
Grok reasoning models on Vertex report reasoning token counts in usage
|
|
@@ -2086,21 +2080,22 @@ The following models are available through the MaaS provider. You can also pass
|
|
|
2086
2080
|
|
|
2087
2081
|
| Model ID | Provider |
|
|
2088
2082
|
| ---------------------------------------------- | -------- |
|
|
2089
|
-
| `deepseek-ai/deepseek-r1-0528-maas`
|
|
2090
|
-
| `deepseek-ai/deepseek-v3.1-maas`
|
|
2091
|
-
| `deepseek-ai/deepseek-v3.2-maas`
|
|
2092
|
-
| `openai/gpt-oss-120b-maas`
|
|
2093
|
-
| `openai/gpt-oss-20b-maas`
|
|
2083
|
+
| `deepseek-ai/deepseek-r1-0528-maas` | DeepSeek |
|
|
2084
|
+
| `deepseek-ai/deepseek-v3.1-maas` | DeepSeek |
|
|
2085
|
+
| `deepseek-ai/deepseek-v3.2-maas` | DeepSeek |
|
|
2086
|
+
| `openai/gpt-oss-120b-maas` | OpenAI |
|
|
2087
|
+
| `openai/gpt-oss-20b-maas` | OpenAI |
|
|
2094
2088
|
| `meta/llama-4-maverick-17b-128e-instruct-maas` | Meta |
|
|
2095
|
-
| `meta/llama-4-scout-17b-16e-instruct-maas`
|
|
2089
|
+
| `meta/llama-4-scout-17b-16e-instruct-maas` | Meta |
|
|
2096
2090
|
| `minimax/minimax-m2-maas` | MiniMax |
|
|
2097
|
-
| `qwen/qwen3-coder-480b-a35b-instruct-maas`
|
|
2098
|
-
| `qwen/qwen3-next-80b-a3b-instruct-maas`
|
|
2099
|
-
| `qwen/qwen3-next-80b-a3b-thinking-maas`
|
|
2091
|
+
| `qwen/qwen3-coder-480b-a35b-instruct-maas` | Qwen |
|
|
2092
|
+
| `qwen/qwen3-next-80b-a3b-instruct-maas` | Qwen |
|
|
2093
|
+
| `qwen/qwen3-next-80b-a3b-thinking-maas` | Qwen |
|
|
2100
2094
|
| `moonshotai/kimi-k2-thinking-maas` | Moonshot |
|
|
2101
2095
|
|
|
2102
2096
|
<Note>
|
|
2103
2097
|
Model availability depends on your Google Cloud project and region. Check the
|
|
2104
|
-
[Vertex AI Model
|
|
2105
|
-
for the
|
|
2098
|
+
[Vertex AI Model
|
|
2099
|
+
Garden](https://console.cloud.google.com/vertex-ai/model-garden) for the
|
|
2100
|
+
latest available models.
|
|
2106
2101
|
</Note>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/google-vertex",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.76",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -72,11 +72,11 @@
|
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"google-auth-library": "^10.5.0",
|
|
75
|
-
"@ai-sdk/anthropic": "4.0.0-canary.
|
|
76
|
-
"@ai-sdk/
|
|
77
|
-
"@ai-sdk/
|
|
75
|
+
"@ai-sdk/anthropic": "4.0.0-canary.49",
|
|
76
|
+
"@ai-sdk/openai-compatible": "3.0.0-canary.43",
|
|
77
|
+
"@ai-sdk/google": "4.0.0-canary.57",
|
|
78
78
|
"@ai-sdk/provider": "4.0.0-canary.16",
|
|
79
|
-
"@ai-sdk/provider-utils": "5.0.0-canary.
|
|
79
|
+
"@ai-sdk/provider-utils": "5.0.0-canary.36"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@types/node": "20.17.24",
|