@ai-sdk/google-vertex 4.0.59 → 4.0.61

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,20 @@
1
1
  # @ai-sdk/google-vertex
2
2
 
3
+ ## 4.0.61
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [b094c07]
8
+ - @ai-sdk/anthropic@3.0.46
9
+
10
+ ## 4.0.60
11
+
12
+ ### Patch Changes
13
+
14
+ - 765b013: feat(provider/google): add support for `gemini-3.1-pro-preview`
15
+ - Updated dependencies [765b013]
16
+ - @ai-sdk/google@3.0.30
17
+
3
18
  ## 4.0.59
4
19
 
5
20
  ### Patch Changes
@@ -32,7 +32,7 @@ var import_provider_utils3 = require("@ai-sdk/provider-utils");
32
32
  var import_provider_utils = require("@ai-sdk/provider-utils");
33
33
 
34
34
  // src/version.ts
35
- var VERSION = true ? "4.0.59" : "0.0.0-test";
35
+ var VERSION = true ? "4.0.61" : "0.0.0-test";
36
36
 
37
37
  // src/edge/google-vertex-auth-edge.ts
38
38
  var loadCredentials = async () => {
@@ -10,7 +10,7 @@ import {
10
10
  } from "@ai-sdk/provider-utils";
11
11
 
12
12
  // src/version.ts
13
- var VERSION = true ? "4.0.59" : "0.0.0-test";
13
+ var VERSION = true ? "4.0.61" : "0.0.0-test";
14
14
 
15
15
  // src/edge/google-vertex-auth-edge.ts
16
16
  var loadCredentials = async () => {
@@ -24,7 +24,7 @@ declare class GoogleVertexEmbeddingModel implements EmbeddingModelV3 {
24
24
 
25
25
  type GoogleVertexImageModelId = 'imagen-3.0-generate-001' | 'imagen-3.0-generate-002' | 'imagen-3.0-fast-generate-001' | 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | (string & {});
26
26
 
27
- type GoogleVertexModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
27
+ type GoogleVertexModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3.1-pro-preview' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
28
28
 
29
29
  declare const googleVertexTools: {
30
30
  googleSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
@@ -24,7 +24,7 @@ declare class GoogleVertexEmbeddingModel implements EmbeddingModelV3 {
24
24
 
25
25
  type GoogleVertexImageModelId = 'imagen-3.0-generate-001' | 'imagen-3.0-generate-002' | 'imagen-3.0-fast-generate-001' | 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | (string & {});
26
26
 
27
- type GoogleVertexModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
27
+ type GoogleVertexModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3.1-pro-preview' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
28
28
 
29
29
  declare const googleVertexTools: {
30
30
  googleSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
@@ -33,7 +33,7 @@ var import_internal3 = require("@ai-sdk/google/internal");
33
33
  var import_provider_utils5 = require("@ai-sdk/provider-utils");
34
34
 
35
35
  // src/version.ts
36
- var VERSION = true ? "4.0.59" : "0.0.0-test";
36
+ var VERSION = true ? "4.0.61" : "0.0.0-test";
37
37
 
38
38
  // src/google-vertex-embedding-model.ts
39
39
  var import_provider = require("@ai-sdk/provider");
@@ -14,7 +14,7 @@ import {
14
14
  } from "@ai-sdk/provider-utils";
15
15
 
16
16
  // src/version.ts
17
- var VERSION = true ? "4.0.59" : "0.0.0-test";
17
+ var VERSION = true ? "4.0.61" : "0.0.0-test";
18
18
 
19
19
  // src/google-vertex-embedding-model.ts
20
20
  import {
package/dist/index.d.mts CHANGED
@@ -99,7 +99,7 @@ declare class GoogleVertexEmbeddingModel implements EmbeddingModelV3 {
99
99
  doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV3['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV3['doEmbed']>>>;
100
100
  }
101
101
 
102
- type GoogleVertexModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
102
+ type GoogleVertexModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3.1-pro-preview' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
103
103
 
104
104
  declare const googleVertexTools: {
105
105
  googleSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
package/dist/index.d.ts CHANGED
@@ -99,7 +99,7 @@ declare class GoogleVertexEmbeddingModel implements EmbeddingModelV3 {
99
99
  doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV3['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV3['doEmbed']>>>;
100
100
  }
101
101
 
102
- type GoogleVertexModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
102
+ type GoogleVertexModelId = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-lite' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-1.5-flash' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-pro' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-1.0-pro-001' | 'gemini-1.0-pro-vision-001' | 'gemini-1.0-pro' | 'gemini-1.0-pro-002' | 'gemini-2.0-flash-lite-preview-02-05' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-3.1-pro-preview' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
103
103
 
104
104
  declare const googleVertexTools: {
105
105
  googleSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
package/dist/index.js CHANGED
@@ -55,7 +55,7 @@ var import_internal3 = require("@ai-sdk/google/internal");
55
55
  var import_provider_utils5 = require("@ai-sdk/provider-utils");
56
56
 
57
57
  // src/version.ts
58
- var VERSION = true ? "4.0.59" : "0.0.0-test";
58
+ var VERSION = true ? "4.0.61" : "0.0.0-test";
59
59
 
60
60
  // src/google-vertex-embedding-model.ts
61
61
  var import_provider = require("@ai-sdk/provider");
package/dist/index.mjs CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  } from "@ai-sdk/provider-utils";
36
36
 
37
37
  // src/version.ts
38
- var VERSION = true ? "4.0.59" : "0.0.0-test";
38
+ var VERSION = true ? "4.0.61" : "0.0.0-test";
39
39
 
40
40
  // src/google-vertex-embedding-model.ts
41
41
  import {
@@ -276,7 +276,7 @@ const model = vertex('gemini-1.5-pro');
276
276
  await generateText({
277
277
  model,
278
278
  providerOptions: {
279
- google: {
279
+ vertex: {
280
280
  safetySettings: [
281
281
  {
282
282
  category: 'HARM_CATEGORY_UNSPECIFIED',
@@ -441,7 +441,7 @@ const result = await generateText({
441
441
  google_maps: vertex.tools.googleMaps({}),
442
442
  },
443
443
  providerOptions: {
444
- google: {
444
+ vertex: {
445
445
  retrievalConfig: {
446
446
  latLng: { latitude: 34.090199, longitude: -117.881081 },
447
447
  },
@@ -457,19 +457,18 @@ The optional `retrievalConfig.latLng` provider option provides location context
457
457
 
458
458
  Google Vertex AI, through its support for Gemini models, can also emit "thinking" tokens, representing the model's reasoning process. The AI SDK exposes these as reasoning information.
459
459
 
460
- To enable thinking tokens for compatible Gemini models via Vertex, set `includeThoughts: true` in the `thinkingConfig` provider option. Since the Vertex provider uses the Google provider's underlying language model, these options are passed through `providerOptions.google`:
460
+ To enable thinking tokens for compatible Gemini models via Vertex, set `includeThoughts: true` in the `thinkingConfig` provider option. These options are passed through `providerOptions.vertex`:
461
461
 
462
462
  ```ts
463
463
  import { vertex } from '@ai-sdk/google-vertex';
464
- import { GoogleLanguageModelOptions } from '@ai-sdk/google'; // Note: importing from @ai-sdk/google
464
+ import { type GoogleLanguageModelOptions } from '@ai-sdk/google';
465
465
  import { generateText, streamText } from 'ai';
466
466
 
467
467
  // For generateText:
468
468
  const { text, reasoningText, reasoning } = await generateText({
469
469
  model: vertex('gemini-2.0-flash-001'), // Or other supported model via Vertex
470
470
  providerOptions: {
471
- google: {
472
- // Options are nested under 'google' for Vertex provider
471
+ vertex: {
473
472
  thinkingConfig: {
474
473
  includeThoughts: true,
475
474
  // thinkingBudget: 2048, // Optional
@@ -487,8 +486,7 @@ console.log('Final Text:', text);
487
486
  const result = streamText({
488
487
  model: vertex('gemini-2.0-flash-001'), // Or other supported model via Vertex
489
488
  providerOptions: {
490
- google: {
491
- // Options are nested under 'google' for Vertex provider
489
+ vertex: {
492
490
  thinkingConfig: {
493
491
  includeThoughts: true,
494
492
  // thinkingBudget: 2048, // Optional
@@ -581,7 +579,7 @@ const { text: meatLasagna, providerMetadata } = await generateText({
581
579
  });
582
580
 
583
581
  // Check cached token count in usage metadata
584
- console.log('Cached tokens:', providerMetadata.google);
582
+ console.log('Cached tokens:', providerMetadata.vertex);
585
583
  // e.g.
586
584
  // {
587
585
  // groundingMetadata: null,
@@ -642,7 +640,7 @@ const { text: veggieLasagnaRecipe } = await generateText({
642
640
  model: vertex('gemini-2.5-pro'),
643
641
  prompt: 'Write a vegetarian lasagna recipe for 4 people.',
644
642
  providerOptions: {
645
- google: {
643
+ vertex: {
646
644
  cachedContent: cache.name,
647
645
  } satisfies GoogleLanguageModelOptions,
648
646
  },
@@ -652,7 +650,7 @@ const { text: meatLasagnaRecipe } = await generateText({
652
650
  model: vertex('gemini-2.5-pro'),
653
651
  prompt: 'Write a meat lasagna recipe for 12 people.',
654
652
  providerOptions: {
655
- google: {
653
+ vertex: {
656
654
  cachedContent: cache.name,
657
655
  } satisfies GoogleLanguageModelOptions,
658
656
  },
@@ -717,27 +715,33 @@ The errors that you get in this case look like this:
717
715
  By default, structured outputs are enabled (and for tool calling they are required).
718
716
  You can disable structured outputs for object generation as a workaround:
719
717
 
720
- ```ts highlight="3,8"
721
- const result = await generateObject({
718
+ ```ts highlight="7,12"
719
+ import { vertex } from '@ai-sdk/google-vertex';
720
+ import { type GoogleLanguageModelOptions } from '@ai-sdk/google';
721
+ import { generateText, Output } from 'ai';
722
+
723
+ const result = await generateText({
722
724
  model: vertex('gemini-1.5-pro'),
723
725
  providerOptions: {
724
- google: {
726
+ vertex: {
725
727
  structuredOutputs: false,
726
728
  } satisfies GoogleLanguageModelOptions,
727
729
  },
728
- schema: z.object({
729
- name: z.string(),
730
- age: z.number(),
731
- contact: z.union([
732
- z.object({
733
- type: z.literal('email'),
734
- value: z.string(),
735
- }),
736
- z.object({
737
- type: z.literal('phone'),
738
- value: z.string(),
739
- }),
740
- ]),
730
+ output: Output.object({
731
+ schema: z.object({
732
+ name: z.string(),
733
+ age: z.number(),
734
+ contact: z.union([
735
+ z.object({
736
+ type: z.literal('email'),
737
+ value: z.string(),
738
+ }),
739
+ z.object({
740
+ type: z.literal('phone'),
741
+ value: z.string(),
742
+ }),
743
+ ]),
744
+ }),
741
745
  }),
742
746
  prompt: 'Generate an example person for testing.',
743
747
  });
@@ -789,7 +793,7 @@ const { embedding } = await embed({
789
793
  model,
790
794
  value: 'sunny day at the beach',
791
795
  providerOptions: {
792
- google: {
796
+ vertex: {
793
797
  outputDimensionality: 512, // optional, number of dimensions for the embedding
794
798
  taskType: 'SEMANTIC_SIMILARITY', // optional, specifies the task type for generating embeddings
795
799
  autoTruncate: false, // optional
@@ -1402,13 +1406,14 @@ const { text } = await generateText({
1402
1406
  });
1403
1407
  ```
1404
1408
 
1405
- Anthropic language models can also be used in the `streamText`, `generateObject`, and `streamObject` functions
1409
+ Anthropic language models can also be used in the `streamText` function
1410
+ and support structured data generation with [`Output`](/docs/reference/ai-sdk-core/output)
1406
1411
  (see [AI SDK Core](/docs/ai-sdk-core)).
1407
1412
 
1408
1413
  <Note>
1409
1414
  The Anthropic API returns streaming tool calls all at once after a delay. This
1410
- causes the `streamObject` function to generate the object fully after a delay
1411
- instead of streaming it incrementally.
1415
+ causes structured output generation to complete fully after a delay instead of
1416
+ streaming incrementally.
1412
1417
  </Note>
1413
1418
 
1414
1419
  The following optional provider options are available for Anthropic models:
@@ -1465,8 +1470,8 @@ In the messages and message parts, you can use the `providerOptions` property to
1465
1470
  You need to set the `anthropic` property in the `providerOptions` object to `{ cacheControl: { type: 'ephemeral' } }` to set a cache control breakpoint.
1466
1471
 
1467
1472
  The cache creation input tokens are then returned in the `providerMetadata` object
1468
- for `generateText` and `generateObject`, again under the `anthropic` property.
1469
- When you use `streamText` or `streamObject`, the response contains a promise
1473
+ for `generateText`, again under the `anthropic` property.
1474
+ When you use `streamText`, the response contains a promise
1470
1475
  that resolves to the metadata. Alternatively you can receive it in the
1471
1476
  `onFinish` callback.
1472
1477
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google-vertex",
3
- "version": "4.0.59",
3
+ "version": "4.0.61",
4
4
  "license": "Apache-2.0",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/index.js",
@@ -48,10 +48,10 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "google-auth-library": "^10.5.0",
51
- "@ai-sdk/anthropic": "3.0.45",
52
- "@ai-sdk/google": "3.0.29",
51
+ "@ai-sdk/anthropic": "3.0.46",
53
52
  "@ai-sdk/provider": "3.0.8",
54
- "@ai-sdk/provider-utils": "4.0.15"
53
+ "@ai-sdk/provider-utils": "4.0.15",
54
+ "@ai-sdk/google": "3.0.30"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/node": "20.17.24",
@@ -23,6 +23,7 @@ export type GoogleVertexModelId =
23
23
  | 'gemini-2.0-flash-lite-preview-02-05'
24
24
  | 'gemini-2.5-flash-lite-preview-09-2025'
25
25
  | 'gemini-2.5-flash-preview-09-2025'
26
+ | 'gemini-3.1-pro-preview'
26
27
  | 'gemini-3-pro-preview'
27
28
  | 'gemini-3-pro-image-preview'
28
29
  | 'gemini-3-flash-preview'