@ai-sdk/google-vertex 5.0.0-beta.45 → 5.0.0-beta.47

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.
@@ -1,186 +0,0 @@
1
- // src/anthropic/google-vertex-anthropic-provider-node.ts
2
- import { resolve } from "@ai-sdk/provider-utils";
3
-
4
- // src/google-vertex-auth-google-auth-library.ts
5
- import { GoogleAuth } from "google-auth-library";
6
- var authInstance = null;
7
- var authOptions = null;
8
- function getAuth(options) {
9
- if (!authInstance || options !== authOptions) {
10
- authInstance = new GoogleAuth({
11
- scopes: ["https://www.googleapis.com/auth/cloud-platform"],
12
- ...options
13
- });
14
- authOptions = options;
15
- }
16
- return authInstance;
17
- }
18
- async function generateAuthToken(options) {
19
- const auth = getAuth(options || {});
20
- const client = await auth.getClient();
21
- const token = await client.getAccessToken();
22
- return (token == null ? void 0 : token.token) || null;
23
- }
24
-
25
- // src/anthropic/google-vertex-anthropic-provider.ts
26
- import {
27
- NoSuchModelError
28
- } from "@ai-sdk/provider";
29
- import {
30
- loadOptionalSetting,
31
- withoutTrailingSlash
32
- } from "@ai-sdk/provider-utils";
33
- import {
34
- anthropicTools,
35
- AnthropicMessagesLanguageModel
36
- } from "@ai-sdk/anthropic/internal";
37
- var vertexAnthropicTools = {
38
- /**
39
- * The bash tool enables Claude to execute shell commands in a persistent bash session,
40
- * allowing system operations, script execution, and command-line automation.
41
- *
42
- * Image results are supported.
43
- */
44
- bash_20241022: anthropicTools.bash_20241022,
45
- /**
46
- * The bash tool enables Claude to execute shell commands in a persistent bash session,
47
- * allowing system operations, script execution, and command-line automation.
48
- *
49
- * Image results are supported.
50
- */
51
- bash_20250124: anthropicTools.bash_20250124,
52
- /**
53
- * Claude can use an Anthropic-defined text editor tool to view and modify text files,
54
- * helping you debug, fix, and improve your code or other text documents.
55
- *
56
- * Supported models: Claude Sonnet 3.5
57
- */
58
- textEditor_20241022: anthropicTools.textEditor_20241022,
59
- /**
60
- * Claude can use an Anthropic-defined text editor tool to view and modify text files,
61
- * helping you debug, fix, and improve your code or other text documents.
62
- *
63
- * Supported models: Claude Sonnet 3.7
64
- */
65
- textEditor_20250124: anthropicTools.textEditor_20250124,
66
- /**
67
- * Claude can use an Anthropic-defined text editor tool to view and modify text files.
68
- * Note: This version does not support the "undo_edit" command.
69
- * @deprecated Use textEditor_20250728 instead
70
- */
71
- textEditor_20250429: anthropicTools.textEditor_20250429,
72
- /**
73
- * Claude can use an Anthropic-defined text editor tool to view and modify text files.
74
- * Note: This version does not support the "undo_edit" command and adds optional max_characters parameter.
75
- * Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1
76
- */
77
- textEditor_20250728: anthropicTools.textEditor_20250728,
78
- /**
79
- * Claude can interact with computer environments through the computer use tool, which
80
- * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
81
- *
82
- * Image results are supported.
83
- */
84
- computer_20241022: anthropicTools.computer_20241022,
85
- /**
86
- * Creates a web search tool that gives Claude direct access to real-time web content.
87
- */
88
- webSearch_20250305: anthropicTools.webSearch_20250305,
89
- /**
90
- * Creates a tool search tool that uses regex patterns to find tools.
91
- *
92
- * The tool search tool enables Claude to work with hundreds or thousands of tools
93
- * by dynamically discovering and loading them on-demand.
94
- *
95
- * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
96
- * to mark them for deferred loading.
97
- */
98
- toolSearchRegex_20251119: anthropicTools.toolSearchRegex_20251119,
99
- /**
100
- * Creates a tool search tool that uses BM25 (natural language) to find tools.
101
- *
102
- * The tool search tool enables Claude to work with hundreds or thousands of tools
103
- * by dynamically discovering and loading them on-demand.
104
- *
105
- * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
106
- * to mark them for deferred loading.
107
- */
108
- toolSearchBm25_20251119: anthropicTools.toolSearchBm25_20251119
109
- };
110
- function createVertexAnthropic(options = {}) {
111
- const getBaseURL = () => {
112
- var _a;
113
- const location = loadOptionalSetting({
114
- settingValue: options.location,
115
- environmentVariableName: "GOOGLE_VERTEX_LOCATION"
116
- });
117
- const project = loadOptionalSetting({
118
- settingValue: options.project,
119
- environmentVariableName: "GOOGLE_VERTEX_PROJECT"
120
- });
121
- return (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : `https://${location === "global" ? "" : location + "-"}aiplatform.googleapis.com/v1/projects/${project}/locations/${location}/publishers/anthropic/models`;
122
- };
123
- const createChatModel = (modelId) => {
124
- var _a;
125
- return new AnthropicMessagesLanguageModel(modelId, {
126
- provider: "vertex.anthropic.messages",
127
- baseURL: getBaseURL(),
128
- headers: (_a = options.headers) != null ? _a : {},
129
- fetch: options.fetch,
130
- buildRequestUrl: (baseURL, isStreaming) => `${baseURL}/${modelId}:${isStreaming ? "streamRawPredict" : "rawPredict"}`,
131
- transformRequestBody: (args) => {
132
- const { model: _model, ...rest } = args;
133
- return {
134
- ...rest,
135
- anthropic_version: "vertex-2023-10-16"
136
- };
137
- },
138
- // Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion
139
- supportedUrls: () => ({}),
140
- // force the use of JSON tool fallback for structured outputs since beta header isn't supported
141
- supportsNativeStructuredOutput: false,
142
- // Vertex Anthropic doesn't support strict mode on tool definitions.
143
- supportsStrictTools: false
144
- });
145
- };
146
- const provider = function(modelId) {
147
- if (new.target) {
148
- throw new Error(
149
- "The Anthropic model function cannot be called with the new keyword."
150
- );
151
- }
152
- return createChatModel(modelId);
153
- };
154
- provider.specificationVersion = "v4";
155
- provider.languageModel = createChatModel;
156
- provider.chat = createChatModel;
157
- provider.messages = createChatModel;
158
- provider.embeddingModel = (modelId) => {
159
- throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
160
- };
161
- provider.textEmbeddingModel = provider.embeddingModel;
162
- provider.imageModel = (modelId) => {
163
- throw new NoSuchModelError({ modelId, modelType: "imageModel" });
164
- };
165
- provider.tools = vertexAnthropicTools;
166
- return provider;
167
- }
168
-
169
- // src/anthropic/google-vertex-anthropic-provider-node.ts
170
- function createVertexAnthropic2(options = {}) {
171
- return createVertexAnthropic({
172
- ...options,
173
- headers: async () => ({
174
- Authorization: `Bearer ${await generateAuthToken(
175
- options.googleAuthOptions
176
- )}`,
177
- ...await resolve(options.headers)
178
- })
179
- });
180
- }
181
- var vertexAnthropic = createVertexAnthropic2();
182
- export {
183
- createVertexAnthropic2 as createVertexAnthropic,
184
- vertexAnthropic
185
- };
186
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/anthropic/google-vertex-anthropic-provider-node.ts","../../src/google-vertex-auth-google-auth-library.ts","../../src/anthropic/google-vertex-anthropic-provider.ts"],"sourcesContent":["import { resolve } from '@ai-sdk/provider-utils';\nimport { GoogleAuthOptions } from 'google-auth-library';\nimport { generateAuthToken } from '../google-vertex-auth-google-auth-library';\nimport {\n createVertexAnthropic as createVertexAnthropicOriginal,\n GoogleVertexAnthropicProvider,\n GoogleVertexAnthropicProviderSettings as GoogleVertexAnthropicProviderSettingsOriginal,\n} from './google-vertex-anthropic-provider';\n\nexport type { GoogleVertexAnthropicProvider };\n\nexport interface GoogleVertexAnthropicProviderSettings extends GoogleVertexAnthropicProviderSettingsOriginal {\n /**\n * Optional. The Authentication options provided by google-auth-library.\n * Complete list of authentication options is documented in the\n * GoogleAuthOptions interface:\n * https://github.com/googleapis/google-auth-library-nodejs/blob/main/src/auth/googleauth.ts.\n */\n googleAuthOptions?: GoogleAuthOptions;\n}\n\nexport function createVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n return createVertexAnthropicOriginal({\n ...options,\n headers: async () => ({\n Authorization: `Bearer ${await generateAuthToken(\n options.googleAuthOptions,\n )}`,\n ...(await resolve(options.headers)),\n }),\n });\n}\n\n/**\n * Default Google Vertex Anthropic provider instance.\n */\nexport const vertexAnthropic = createVertexAnthropic();\n","import { GoogleAuth, GoogleAuthOptions } from 'google-auth-library';\n\nlet authInstance: GoogleAuth | null = null;\nlet authOptions: GoogleAuthOptions | null = null;\n\nfunction getAuth(options: GoogleAuthOptions) {\n if (!authInstance || options !== authOptions) {\n authInstance = new GoogleAuth({\n scopes: ['https://www.googleapis.com/auth/cloud-platform'],\n ...options,\n });\n authOptions = options;\n }\n return authInstance;\n}\n\nexport async function generateAuthToken(options?: GoogleAuthOptions) {\n const auth = getAuth(options || {});\n const client = await auth.getClient();\n const token = await client.getAccessToken();\n return token?.token || null;\n}\n\n// For testing purposes only\nexport function _resetAuthInstance() {\n authInstance = null;\n}\n","import {\n LanguageModelV4,\n NoSuchModelError,\n ProviderV4,\n} from '@ai-sdk/provider';\nimport {\n FetchFunction,\n Resolvable,\n loadOptionalSetting,\n withoutTrailingSlash,\n} from '@ai-sdk/provider-utils';\nimport {\n anthropicTools,\n AnthropicMessagesLanguageModel,\n} from '@ai-sdk/anthropic/internal';\nimport { GoogleVertexAnthropicMessagesModelId } from './google-vertex-anthropic-messages-options';\n\n/**\n * Tools supported by Google Vertex Anthropic.\n * This is a subset of the full Anthropic tools - only these are recognized by the Vertex API.\n */\nexport const vertexAnthropicTools = {\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20241022: anthropicTools.bash_20241022,\n\n /**\n * The bash tool enables Claude to execute shell commands in a persistent bash session,\n * allowing system operations, script execution, and command-line automation.\n *\n * Image results are supported.\n */\n bash_20250124: anthropicTools.bash_20250124,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents.\n *\n * Supported models: Claude Sonnet 3.5\n */\n textEditor_20241022: anthropicTools.textEditor_20241022,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files,\n * helping you debug, fix, and improve your code or other text documents.\n *\n * Supported models: Claude Sonnet 3.7\n */\n textEditor_20250124: anthropicTools.textEditor_20250124,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files.\n * Note: This version does not support the \"undo_edit\" command.\n * @deprecated Use textEditor_20250728 instead\n */\n textEditor_20250429: anthropicTools.textEditor_20250429,\n\n /**\n * Claude can use an Anthropic-defined text editor tool to view and modify text files.\n * Note: This version does not support the \"undo_edit\" command and adds optional max_characters parameter.\n * Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1\n */\n textEditor_20250728: anthropicTools.textEditor_20250728,\n\n /**\n * Claude can interact with computer environments through the computer use tool, which\n * provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.\n *\n * Image results are supported.\n */\n computer_20241022: anthropicTools.computer_20241022,\n\n /**\n * Creates a web search tool that gives Claude direct access to real-time web content.\n */\n webSearch_20250305: anthropicTools.webSearch_20250305,\n\n /**\n * Creates a tool search tool that uses regex patterns to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n */\n toolSearchRegex_20251119: anthropicTools.toolSearchRegex_20251119,\n\n /**\n * Creates a tool search tool that uses BM25 (natural language) to find tools.\n *\n * The tool search tool enables Claude to work with hundreds or thousands of tools\n * by dynamically discovering and loading them on-demand.\n *\n * Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools\n * to mark them for deferred loading.\n */\n toolSearchBm25_20251119: anthropicTools.toolSearchBm25_20251119,\n};\nexport interface GoogleVertexAnthropicProvider extends ProviderV4 {\n /**\n * Creates a model for text generation.\n */\n (modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV4;\n\n /**\n * Creates a model for text generation.\n */\n languageModel(modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV4;\n\n /**\n * Anthropic tools supported by Google Vertex.\n * Note: Only a subset of Anthropic tools are available on Vertex.\n * Supported tools: bash_20241022, bash_20250124, textEditor_20241022,\n * textEditor_20250124, textEditor_20250429, textEditor_20250728,\n * computer_20241022, webSearch_20250305, toolSearchRegex_20251119,\n * toolSearchBm25_20251119\n */\n tools: typeof vertexAnthropicTools;\n\n /**\n * @deprecated Use `embeddingModel` instead.\n */\n textEmbeddingModel(modelId: string): never;\n}\n\nexport interface GoogleVertexAnthropicProviderSettings {\n /**\n * Google Cloud project ID. Defaults to the value of the `GOOGLE_VERTEX_PROJECT` environment variable.\n */\n project?: string;\n\n /**\n * Google Cloud region. Defaults to the value of the `GOOGLE_VERTEX_LOCATION` environment variable.\n */\n location?: string;\n\n /**\n * Use a different URL prefix for API calls, e.g. to use proxy servers.\n * The default prefix is `https://api.anthropic.com/v1`.\n */\n baseURL?: string;\n\n /**\n * Custom headers to include in the requests.\n */\n headers?: Resolvable<Record<string, string | undefined>>;\n\n /**\n * Custom fetch implementation. You can use it as a middleware to intercept requests,\n * or to provide a custom fetch implementation for e.g. testing.\n */\n fetch?: FetchFunction;\n}\n\n/**\n * Create a Google Vertex Anthropic provider instance.\n */\nexport function createVertexAnthropic(\n options: GoogleVertexAnthropicProviderSettings = {},\n): GoogleVertexAnthropicProvider {\n const getBaseURL = () => {\n const location = loadOptionalSetting({\n settingValue: options.location,\n environmentVariableName: 'GOOGLE_VERTEX_LOCATION',\n });\n const project = loadOptionalSetting({\n settingValue: options.project,\n environmentVariableName: 'GOOGLE_VERTEX_PROJECT',\n });\n\n return (\n withoutTrailingSlash(options.baseURL) ??\n `https://${location === 'global' ? '' : location + '-'}aiplatform.googleapis.com/v1/projects/${project}/locations/${location}/publishers/anthropic/models`\n );\n };\n\n const createChatModel = (modelId: GoogleVertexAnthropicMessagesModelId) =>\n new AnthropicMessagesLanguageModel(modelId, {\n provider: 'vertex.anthropic.messages',\n baseURL: getBaseURL(),\n headers: options.headers ?? {},\n fetch: options.fetch,\n\n buildRequestUrl: (baseURL, isStreaming) =>\n `${baseURL}/${modelId}:${\n isStreaming ? 'streamRawPredict' : 'rawPredict'\n }`,\n transformRequestBody: args => {\n // Remove model from args and add anthropic version\n const { model: _model, ...rest } = args;\n return {\n ...rest,\n anthropic_version: 'vertex-2023-10-16',\n };\n },\n // Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion\n supportedUrls: () => ({}),\n // force the use of JSON tool fallback for structured outputs since beta header isn't supported\n supportsNativeStructuredOutput: false,\n // Vertex Anthropic doesn't support strict mode on tool definitions.\n supportsStrictTools: false,\n });\n\n const provider = function (modelId: GoogleVertexAnthropicMessagesModelId) {\n if (new.target) {\n throw new Error(\n 'The Anthropic model function cannot be called with the new keyword.',\n );\n }\n\n return createChatModel(modelId);\n };\n\n provider.specificationVersion = 'v4' as const;\n provider.languageModel = createChatModel;\n provider.chat = createChatModel;\n provider.messages = createChatModel;\n\n provider.embeddingModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n };\n provider.textEmbeddingModel = provider.embeddingModel;\n provider.imageModel = (modelId: string) => {\n throw new NoSuchModelError({ modelId, modelType: 'imageModel' });\n };\n\n provider.tools = vertexAnthropicTools;\n\n return provider;\n}\n"],"mappings":";AAAA,SAAS,eAAe;;;ACAxB,SAAS,kBAAqC;AAE9C,IAAI,eAAkC;AACtC,IAAI,cAAwC;AAE5C,SAAS,QAAQ,SAA4B;AAC3C,MAAI,CAAC,gBAAgB,YAAY,aAAa;AAC5C,mBAAe,IAAI,WAAW;AAAA,MAC5B,QAAQ,CAAC,gDAAgD;AAAA,MACzD,GAAG;AAAA,IACL,CAAC;AACD,kBAAc;AAAA,EAChB;AACA,SAAO;AACT;AAEA,eAAsB,kBAAkB,SAA6B;AACnE,QAAM,OAAO,QAAQ,WAAW,CAAC,CAAC;AAClC,QAAM,SAAS,MAAM,KAAK,UAAU;AACpC,QAAM,QAAQ,MAAM,OAAO,eAAe;AAC1C,UAAO,+BAAO,UAAS;AACzB;;;ACrBA;AAAA,EAEE;AAAA,OAEK;AACP;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,IAAM,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOlC,eAAe,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9B,eAAe,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9B,qBAAqB,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQpC,qBAAqB,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpC,qBAAqB,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpC,qBAAqB,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQpC,mBAAmB,eAAe;AAAA;AAAA;AAAA;AAAA,EAKlC,oBAAoB,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWnC,0BAA0B,eAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWzC,yBAAyB,eAAe;AAC1C;AA4DO,SAAS,sBACd,UAAiD,CAAC,GACnB;AAC/B,QAAM,aAAa,MAAM;AArK3B;AAsKI,UAAM,WAAW,oBAAoB;AAAA,MACnC,cAAc,QAAQ;AAAA,MACtB,yBAAyB;AAAA,IAC3B,CAAC;AACD,UAAM,UAAU,oBAAoB;AAAA,MAClC,cAAc,QAAQ;AAAA,MACtB,yBAAyB;AAAA,IAC3B,CAAC;AAED,YACE,0BAAqB,QAAQ,OAAO,MAApC,YACA,WAAW,aAAa,WAAW,KAAK,WAAW,GAAG,yCAAyC,OAAO,cAAc,QAAQ;AAAA,EAEhI;AAEA,QAAM,kBAAkB,CAAC,YAA+C;AArL1E;AAsLI,eAAI,+BAA+B,SAAS;AAAA,MAC1C,UAAU;AAAA,MACV,SAAS,WAAW;AAAA,MACpB,UAAS,aAAQ,YAAR,YAAmB,CAAC;AAAA,MAC7B,OAAO,QAAQ;AAAA,MAEf,iBAAiB,CAAC,SAAS,gBACzB,GAAG,OAAO,IAAI,OAAO,IACnB,cAAc,qBAAqB,YACrC;AAAA,MACF,sBAAsB,UAAQ;AAE5B,cAAM,EAAE,OAAO,QAAQ,GAAG,KAAK,IAAI;AACnC,eAAO;AAAA,UACL,GAAG;AAAA,UACH,mBAAmB;AAAA,QACrB;AAAA,MACF;AAAA;AAAA,MAEA,eAAe,OAAO,CAAC;AAAA;AAAA,MAEvB,gCAAgC;AAAA;AAAA,MAEhC,qBAAqB;AAAA,IACvB,CAAC;AAAA;AAEH,QAAM,WAAW,SAAU,SAA+C;AACxE,QAAI,YAAY;AACd,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,WAAO,gBAAgB,OAAO;AAAA,EAChC;AAEA,WAAS,uBAAuB;AAChC,WAAS,gBAAgB;AACzB,WAAS,OAAO;AAChB,WAAS,WAAW;AAEpB,WAAS,iBAAiB,CAAC,YAAoB;AAC7C,UAAM,IAAI,iBAAiB,EAAE,SAAS,WAAW,iBAAiB,CAAC;AAAA,EACrE;AACA,WAAS,qBAAqB,SAAS;AACvC,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,iBAAiB,EAAE,SAAS,WAAW,aAAa,CAAC;AAAA,EACjE;AAEA,WAAS,QAAQ;AAEjB,SAAO;AACT;;;AFrNO,SAASA,uBACd,UAAiD,CAAC,GACnB;AAC/B,SAAO,sBAA8B;AAAA,IACnC,GAAG;AAAA,IACH,SAAS,aAAa;AAAA,MACpB,eAAe,UAAU,MAAM;AAAA,QAC7B,QAAQ;AAAA,MACV,CAAC;AAAA,MACD,GAAI,MAAM,QAAQ,QAAQ,OAAO;AAAA,IACnC;AAAA,EACF,CAAC;AACH;AAKO,IAAM,kBAAkBA,uBAAsB;","names":["createVertexAnthropic"]}
@@ -1,160 +0,0 @@
1
- import { EmbeddingModelV4, ProviderV4, LanguageModelV4, ImageModelV4, Experimental_VideoModelV4 } from '@ai-sdk/provider';
2
- import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
- import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
4
-
5
- type GoogleVertexEmbeddingModelId = 'textembedding-gecko' | 'textembedding-gecko@001' | 'textembedding-gecko@003' | 'textembedding-gecko-multilingual' | 'textembedding-gecko-multilingual@001' | 'text-multilingual-embedding-002' | 'text-embedding-004' | 'text-embedding-005' | 'gemini-embedding-001' | 'gemini-embedding-2-preview' | (string & {});
6
-
7
- interface GoogleVertexConfig {
8
- provider: string;
9
- baseURL: string;
10
- headers: Resolvable<Record<string, string | undefined>>;
11
- fetch?: FetchFunction;
12
- }
13
-
14
- declare class GoogleVertexEmbeddingModel implements EmbeddingModelV4 {
15
- readonly specificationVersion = "v4";
16
- readonly modelId: GoogleVertexEmbeddingModelId;
17
- readonly maxEmbeddingsPerCall = 2048;
18
- readonly supportsParallelCalls = true;
19
- private readonly config;
20
- get provider(): string;
21
- constructor(modelId: GoogleVertexEmbeddingModelId, config: GoogleVertexConfig);
22
- doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV4['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV4['doEmbed']>>>;
23
- }
24
-
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' | 'gemini-3.1-flash-image-preview' | (string & {});
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-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-exp' | (string & {});
28
-
29
- declare const googleVertexTools: {
30
- googleSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
31
- [x: string]: unknown;
32
- searchTypes?: {
33
- webSearch?: Record<string, never> | undefined;
34
- imageSearch?: Record<string, never> | undefined;
35
- } | undefined;
36
- timeRangeFilter?: {
37
- startTime: string;
38
- endTime: string;
39
- } | undefined;
40
- }, {}>;
41
- enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
42
- googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
43
- urlContext: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
44
- fileSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
45
- [x: string]: unknown;
46
- fileSearchStoreNames: string[];
47
- topK?: number | undefined;
48
- metadataFilter?: string | undefined;
49
- }, {}>;
50
- codeExecution: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
51
- language: string;
52
- code: string;
53
- }, {
54
- outcome: string;
55
- output: string;
56
- }, {}, {}>;
57
- vertexRagStore: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
58
- ragCorpus: string;
59
- topK?: number;
60
- }, {}>;
61
- };
62
-
63
- type GoogleVertexVideoModelId = 'veo-2.0-generate-preview' | 'veo-2.0-generate-exp' | 'veo-2.0-generate-001' | 'veo-3.0-generate-001' | 'veo-3.0-fast-generate-001' | 'veo-3.0-generate-preview' | 'veo-3.0-fast-generate-preview' | 'veo-3.1-generate-001' | 'veo-3.1-fast-generate-001' | 'veo-3.1-generate-preview' | 'veo-3.1-fast-generate-preview' | (string & {});
64
-
65
- interface GoogleVertexProvider extends ProviderV4 {
66
- /**
67
- * Creates a model for text generation.
68
- */
69
- (modelId: GoogleVertexModelId): LanguageModelV4;
70
- languageModel: (modelId: GoogleVertexModelId) => LanguageModelV4;
71
- /**
72
- * Creates a model for image generation.
73
- */
74
- image(modelId: GoogleVertexImageModelId): ImageModelV4;
75
- /**
76
- * Creates a model for image generation.
77
- */
78
- imageModel(modelId: GoogleVertexImageModelId): ImageModelV4;
79
- tools: typeof googleVertexTools;
80
- /**
81
- * @deprecated Use `embeddingModel` instead.
82
- */
83
- textEmbeddingModel(modelId: GoogleVertexEmbeddingModelId): GoogleVertexEmbeddingModel;
84
- /**
85
- * Creates a model for video generation.
86
- */
87
- video(modelId: GoogleVertexVideoModelId): Experimental_VideoModelV4;
88
- /**
89
- * Creates a model for video generation.
90
- */
91
- videoModel(modelId: GoogleVertexVideoModelId): Experimental_VideoModelV4;
92
- }
93
- interface GoogleVertexProviderSettings$1 {
94
- /**
95
- * Optional. The API key for the Google Cloud project. If provided, the
96
- * provider will use express mode with API key authentication. Defaults to
97
- * the value of the `GOOGLE_VERTEX_API_KEY` environment variable.
98
- */
99
- apiKey?: string;
100
- /**
101
- * Your Google Vertex location. Defaults to the environment variable `GOOGLE_VERTEX_LOCATION`.
102
- */
103
- location?: string;
104
- /**
105
- * Your Google Vertex project. Defaults to the environment variable `GOOGLE_VERTEX_PROJECT`.
106
- */
107
- project?: string;
108
- /**
109
- * Headers to use for requests. Can be:
110
- * - A headers object
111
- * - A Promise that resolves to a headers object
112
- * - A function that returns a headers object
113
- * - A function that returns a Promise of a headers object
114
- */
115
- headers?: Resolvable<Record<string, string | undefined>>;
116
- /**
117
- * Custom fetch implementation. You can use it as a middleware to intercept requests,
118
- * or to provide a custom fetch implementation for e.g. testing.
119
- */
120
- fetch?: FetchFunction;
121
- generateId?: () => string;
122
- /**
123
- * Base URL for the Google Vertex API calls.
124
- */
125
- baseURL?: string;
126
- }
127
-
128
- interface GoogleCredentials {
129
- /**
130
- * The client email for the Google Cloud service account. Defaults to the
131
- * value of the `GOOGLE_CLIENT_EMAIL` environment variable.
132
- */
133
- clientEmail: string;
134
- /**
135
- * The private key for the Google Cloud service account. Defaults to the
136
- * value of the `GOOGLE_PRIVATE_KEY` environment variable.
137
- */
138
- privateKey: string;
139
- /**
140
- * Optional. The private key ID for the Google Cloud service account. Defaults
141
- * to the value of the `GOOGLE_PRIVATE_KEY_ID` environment variable.
142
- */
143
- privateKeyId?: string;
144
- }
145
-
146
- interface GoogleVertexProviderSettings extends GoogleVertexProviderSettings$1 {
147
- /**
148
- * Optional. The Google credentials for the Google Cloud service account. If
149
- * not provided, the Google Vertex provider will use environment variables to
150
- * load the credentials.
151
- */
152
- googleCredentials?: GoogleCredentials;
153
- }
154
- declare function createVertex(options?: GoogleVertexProviderSettings): GoogleVertexProvider;
155
- /**
156
- * Default Google Vertex AI provider instance.
157
- */
158
- declare const vertex: GoogleVertexProvider;
159
-
160
- export { type GoogleVertexProvider, type GoogleVertexProviderSettings, createVertex, vertex };