@ai-sdk/google-vertex 5.0.0-beta.4 → 5.0.0-beta.41
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 +324 -8
- package/README.md +65 -1
- package/dist/anthropic/edge/index.d.mts +60 -15
- package/dist/anthropic/edge/index.d.ts +60 -15
- package/dist/anthropic/edge/index.js +29 -7
- package/dist/anthropic/edge/index.js.map +1 -1
- package/dist/anthropic/edge/index.mjs +26 -4
- package/dist/anthropic/edge/index.mjs.map +1 -1
- package/dist/anthropic/index.d.mts +60 -15
- package/dist/anthropic/index.d.ts +60 -15
- package/dist/anthropic/index.js +28 -6
- package/dist/anthropic/index.js.map +1 -1
- package/dist/anthropic/index.mjs +25 -3
- package/dist/anthropic/index.mjs.map +1 -1
- package/dist/edge/index.d.mts +19 -19
- package/dist/edge/index.d.ts +19 -19
- package/dist/edge/index.js +8 -8
- package/dist/edge/index.js.map +1 -1
- package/dist/edge/index.mjs +5 -5
- package/dist/edge/index.mjs.map +1 -1
- package/dist/index.d.mts +19 -19
- package/dist/index.d.ts +19 -19
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/index.mjs.map +1 -1
- package/dist/maas/edge/index.d.mts +76 -0
- package/dist/maas/edge/index.d.ts +76 -0
- package/dist/maas/edge/index.js +215 -0
- package/dist/maas/edge/index.js.map +1 -0
- package/dist/maas/edge/index.mjs +196 -0
- package/dist/maas/edge/index.mjs.map +1 -0
- package/dist/maas/index.d.mts +60 -0
- package/dist/maas/index.d.ts +60 -0
- package/dist/maas/index.js +125 -0
- package/dist/maas/index.js.map +1 -0
- package/dist/maas/index.mjs +101 -0
- package/dist/maas/index.mjs.map +1 -0
- package/docs/16-google-vertex.mdx +227 -6
- package/maas/edge.d.ts +1 -0
- package/maas/index.d.ts +1 -0
- package/package.json +19 -8
- package/src/anthropic/edge/google-vertex-anthropic-provider-edge.ts +1 -2
- package/src/anthropic/google-vertex-anthropic-provider-node.ts +1 -2
- package/src/anthropic/google-vertex-anthropic-provider.ts +32 -7
- package/src/edge/google-vertex-provider-edge.ts +1 -2
- package/src/google-vertex-embedding-model.ts +5 -5
- package/src/google-vertex-embedding-options.ts +2 -0
- package/src/google-vertex-image-model.ts +17 -17
- package/src/google-vertex-provider-node.ts +1 -2
- package/src/google-vertex-provider.ts +12 -12
- package/src/google-vertex-video-model.ts +7 -7
- package/src/maas/edge/google-vertex-maas-provider-edge.ts +65 -0
- package/src/maas/edge/index.ts +9 -0
- package/src/maas/google-vertex-maas-options.ts +15 -0
- package/src/maas/google-vertex-maas-provider-node.ts +64 -0
- package/src/maas/google-vertex-maas-provider.ts +111 -0
- package/src/maas/index.ts +9 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GoogleAuthOptions } from 'google-auth-library';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
|
-
import {
|
|
4
|
+
import { ProviderV4, LanguageModelV4 } from '@ai-sdk/provider';
|
|
5
5
|
|
|
6
6
|
type GoogleVertexAnthropicMessagesModelId = 'claude-opus-4-6' | 'claude-sonnet-4-6' | 'claude-opus-4-5@20251101' | 'claude-sonnet-4-5@20250929' | 'claude-opus-4-1@20250805' | 'claude-opus-4@20250514' | 'claude-sonnet-4@20250514' | 'claude-3-7-sonnet@20250219' | 'claude-3-5-sonnet-v2@20241022' | 'claude-3-5-haiku@20241022' | 'claude-3-5-sonnet@20240620' | 'claude-3-haiku@20240307' | 'claude-3-sonnet@20240229' | 'claude-3-opus@20240229' | (string & {});
|
|
7
7
|
|
|
@@ -19,7 +19,7 @@ declare const vertexAnthropicTools: {
|
|
|
19
19
|
bash_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
20
20
|
command: string;
|
|
21
21
|
restart?: boolean;
|
|
22
|
-
}, {}>;
|
|
22
|
+
}, {}, {}>;
|
|
23
23
|
/**
|
|
24
24
|
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
25
25
|
* allowing system operations, script execution, and command-line automation.
|
|
@@ -29,7 +29,7 @@ declare const vertexAnthropicTools: {
|
|
|
29
29
|
bash_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
30
30
|
command: string;
|
|
31
31
|
restart?: boolean;
|
|
32
|
-
}, {}>;
|
|
32
|
+
}, {}, {}>;
|
|
33
33
|
/**
|
|
34
34
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
35
35
|
* helping you debug, fix, and improve your code or other text documents.
|
|
@@ -45,7 +45,7 @@ declare const vertexAnthropicTools: {
|
|
|
45
45
|
insert_text?: string;
|
|
46
46
|
old_str?: string;
|
|
47
47
|
view_range?: number[];
|
|
48
|
-
}, {}>;
|
|
48
|
+
}, {}, {}>;
|
|
49
49
|
/**
|
|
50
50
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
51
51
|
* helping you debug, fix, and improve your code or other text documents.
|
|
@@ -61,7 +61,7 @@ declare const vertexAnthropicTools: {
|
|
|
61
61
|
insert_text?: string;
|
|
62
62
|
old_str?: string;
|
|
63
63
|
view_range?: number[];
|
|
64
|
-
}, {}>;
|
|
64
|
+
}, {}, {}>;
|
|
65
65
|
/**
|
|
66
66
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files.
|
|
67
67
|
* Note: This version does not support the "undo_edit" command.
|
|
@@ -76,7 +76,7 @@ declare const vertexAnthropicTools: {
|
|
|
76
76
|
insert_text?: string;
|
|
77
77
|
old_str?: string;
|
|
78
78
|
view_range?: number[];
|
|
79
|
-
}, {}>;
|
|
79
|
+
}, {}, {}>;
|
|
80
80
|
/**
|
|
81
81
|
* Claude can use an Anthropic-defined text editor tool to view and modify text files.
|
|
82
82
|
* Note: This version does not support the "undo_edit" command and adds optional max_characters parameter.
|
|
@@ -93,7 +93,7 @@ declare const vertexAnthropicTools: {
|
|
|
93
93
|
view_range?: number[];
|
|
94
94
|
}, {
|
|
95
95
|
maxCharacters?: number;
|
|
96
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
96
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
97
97
|
command: "view" | "create" | "str_replace" | "insert";
|
|
98
98
|
path: string;
|
|
99
99
|
file_text?: string;
|
|
@@ -102,7 +102,7 @@ declare const vertexAnthropicTools: {
|
|
|
102
102
|
insert_text?: string;
|
|
103
103
|
old_str?: string;
|
|
104
104
|
view_range?: number[];
|
|
105
|
-
}, unknown>;
|
|
105
|
+
}, unknown, {}>;
|
|
106
106
|
/**
|
|
107
107
|
* Claude can interact with computer environments through the computer use tool, which
|
|
108
108
|
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
@@ -117,7 +117,7 @@ declare const vertexAnthropicTools: {
|
|
|
117
117
|
displayWidthPx: number;
|
|
118
118
|
displayHeightPx: number;
|
|
119
119
|
displayNumber?: number;
|
|
120
|
-
}>;
|
|
120
|
+
}, {}>;
|
|
121
121
|
/**
|
|
122
122
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
123
123
|
*/
|
|
@@ -140,7 +140,7 @@ declare const vertexAnthropicTools: {
|
|
|
140
140
|
country?: string;
|
|
141
141
|
timezone?: string;
|
|
142
142
|
};
|
|
143
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
143
|
+
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
144
144
|
query: string;
|
|
145
145
|
}, {
|
|
146
146
|
type: "web_search_result";
|
|
@@ -148,23 +148,68 @@ declare const vertexAnthropicTools: {
|
|
|
148
148
|
title: string | null;
|
|
149
149
|
pageAge: string | null;
|
|
150
150
|
encryptedContent: string;
|
|
151
|
-
}[]>;
|
|
151
|
+
}[], {}>;
|
|
152
|
+
/**
|
|
153
|
+
* Creates a tool search tool that uses regex patterns to find tools.
|
|
154
|
+
*
|
|
155
|
+
* The tool search tool enables Claude to work with hundreds or thousands of tools
|
|
156
|
+
* by dynamically discovering and loading them on-demand.
|
|
157
|
+
*
|
|
158
|
+
* Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
|
|
159
|
+
* to mark them for deferred loading.
|
|
160
|
+
*/
|
|
161
|
+
toolSearchRegex_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
162
|
+
pattern: string;
|
|
163
|
+
limit?: number;
|
|
164
|
+
}, {
|
|
165
|
+
type: "tool_reference";
|
|
166
|
+
toolName: string;
|
|
167
|
+
}[], {}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
168
|
+
pattern: string;
|
|
169
|
+
limit?: number;
|
|
170
|
+
}, {
|
|
171
|
+
type: "tool_reference";
|
|
172
|
+
toolName: string;
|
|
173
|
+
}[], {}>;
|
|
174
|
+
/**
|
|
175
|
+
* Creates a tool search tool that uses BM25 (natural language) to find tools.
|
|
176
|
+
*
|
|
177
|
+
* The tool search tool enables Claude to work with hundreds or thousands of tools
|
|
178
|
+
* by dynamically discovering and loading them on-demand.
|
|
179
|
+
*
|
|
180
|
+
* Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
|
|
181
|
+
* to mark them for deferred loading.
|
|
182
|
+
*/
|
|
183
|
+
toolSearchBm25_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
184
|
+
query: string;
|
|
185
|
+
limit?: number;
|
|
186
|
+
}, {
|
|
187
|
+
type: "tool_reference";
|
|
188
|
+
toolName: string;
|
|
189
|
+
}[], {}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
190
|
+
query: string;
|
|
191
|
+
limit?: number;
|
|
192
|
+
}, {
|
|
193
|
+
type: "tool_reference";
|
|
194
|
+
toolName: string;
|
|
195
|
+
}[], {}>;
|
|
152
196
|
};
|
|
153
|
-
interface GoogleVertexAnthropicProvider extends
|
|
197
|
+
interface GoogleVertexAnthropicProvider extends ProviderV4 {
|
|
154
198
|
/**
|
|
155
199
|
* Creates a model for text generation.
|
|
156
200
|
*/
|
|
157
|
-
(modelId: GoogleVertexAnthropicMessagesModelId):
|
|
201
|
+
(modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV4;
|
|
158
202
|
/**
|
|
159
203
|
* Creates a model for text generation.
|
|
160
204
|
*/
|
|
161
|
-
languageModel(modelId: GoogleVertexAnthropicMessagesModelId):
|
|
205
|
+
languageModel(modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV4;
|
|
162
206
|
/**
|
|
163
207
|
* Anthropic tools supported by Google Vertex.
|
|
164
208
|
* Note: Only a subset of Anthropic tools are available on Vertex.
|
|
165
209
|
* Supported tools: bash_20241022, bash_20250124, textEditor_20241022,
|
|
166
210
|
* textEditor_20250124, textEditor_20250429, textEditor_20250728,
|
|
167
|
-
* computer_20241022, webSearch_20250305
|
|
211
|
+
* computer_20241022, webSearch_20250305, toolSearchRegex_20251119,
|
|
212
|
+
* toolSearchBm25_20251119
|
|
168
213
|
*/
|
|
169
214
|
tools: typeof vertexAnthropicTools;
|
|
170
215
|
/**
|
package/dist/anthropic/index.js
CHANGED
|
@@ -18,12 +18,12 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/anthropic/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
createVertexAnthropic: () => createVertexAnthropic2,
|
|
24
24
|
vertexAnthropic: () => vertexAnthropic
|
|
25
25
|
});
|
|
26
|
-
module.exports = __toCommonJS(
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
27
|
|
|
28
28
|
// src/anthropic/google-vertex-anthropic-provider-node.ts
|
|
29
29
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
@@ -104,7 +104,27 @@ var vertexAnthropicTools = {
|
|
|
104
104
|
/**
|
|
105
105
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
106
106
|
*/
|
|
107
|
-
webSearch_20250305: import_internal.anthropicTools.webSearch_20250305
|
|
107
|
+
webSearch_20250305: import_internal.anthropicTools.webSearch_20250305,
|
|
108
|
+
/**
|
|
109
|
+
* Creates a tool search tool that uses regex patterns to find tools.
|
|
110
|
+
*
|
|
111
|
+
* The tool search tool enables Claude to work with hundreds or thousands of tools
|
|
112
|
+
* by dynamically discovering and loading them on-demand.
|
|
113
|
+
*
|
|
114
|
+
* Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
|
|
115
|
+
* to mark them for deferred loading.
|
|
116
|
+
*/
|
|
117
|
+
toolSearchRegex_20251119: import_internal.anthropicTools.toolSearchRegex_20251119,
|
|
118
|
+
/**
|
|
119
|
+
* Creates a tool search tool that uses BM25 (natural language) to find tools.
|
|
120
|
+
*
|
|
121
|
+
* The tool search tool enables Claude to work with hundreds or thousands of tools
|
|
122
|
+
* by dynamically discovering and loading them on-demand.
|
|
123
|
+
*
|
|
124
|
+
* Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
|
|
125
|
+
* to mark them for deferred loading.
|
|
126
|
+
*/
|
|
127
|
+
toolSearchBm25_20251119: import_internal.anthropicTools.toolSearchBm25_20251119
|
|
108
128
|
};
|
|
109
129
|
function createVertexAnthropic(options = {}) {
|
|
110
130
|
const getBaseURL = () => {
|
|
@@ -137,7 +157,9 @@ function createVertexAnthropic(options = {}) {
|
|
|
137
157
|
// Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion
|
|
138
158
|
supportedUrls: () => ({}),
|
|
139
159
|
// force the use of JSON tool fallback for structured outputs since beta header isn't supported
|
|
140
|
-
supportsNativeStructuredOutput: false
|
|
160
|
+
supportsNativeStructuredOutput: false,
|
|
161
|
+
// Vertex Anthropic doesn't support strict mode on tool definitions.
|
|
162
|
+
supportsStrictTools: false
|
|
141
163
|
});
|
|
142
164
|
};
|
|
143
165
|
const provider = function(modelId) {
|
|
@@ -148,7 +170,7 @@ function createVertexAnthropic(options = {}) {
|
|
|
148
170
|
}
|
|
149
171
|
return createChatModel(modelId);
|
|
150
172
|
};
|
|
151
|
-
provider.specificationVersion = "
|
|
173
|
+
provider.specificationVersion = "v4";
|
|
152
174
|
provider.languageModel = createChatModel;
|
|
153
175
|
provider.chat = createChatModel;
|
|
154
176
|
provider.messages = createChatModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/anthropic/index.ts","../../src/anthropic/google-vertex-anthropic-provider-node.ts","../../src/google-vertex-auth-google-auth-library.ts","../../src/anthropic/google-vertex-anthropic-provider.ts"],"sourcesContent":["export {\n vertexAnthropic,\n createVertexAnthropic,\n} from './google-vertex-anthropic-provider-node';\nexport type {\n GoogleVertexAnthropicProvider,\n GoogleVertexAnthropicProviderSettings,\n} from './google-vertex-anthropic-provider-node';\n","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\n 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 LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\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};\nexport interface GoogleVertexAnthropicProvider extends ProviderV3 {\n /**\n * Creates a model for text generation.\n */\n (modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV3;\n\n /**\n * Creates a model for text generation.\n */\n languageModel(modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV3;\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\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, ...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 });\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 = 'v3' 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;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,IAAAC,yBAAwB;;;ACAxB,iCAA8C;AAE9C,IAAI,eAAkC;AACtC,IAAI,cAAwC;AAE5C,SAAS,QAAQ,SAA4B;AAC3C,MAAI,CAAC,gBAAgB,YAAY,aAAa;AAC5C,mBAAe,IAAI,sCAAW;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,sBAIO;AACP,4BAKO;AACP,sBAGO;AAOA,IAAM,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOlC,eAAe,+BAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9B,eAAe,+BAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ9B,qBAAqB,+BAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQpC,qBAAqB,+BAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpC,qBAAqB,+BAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOpC,qBAAqB,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AiB,CAAC,YAAoB;AAC7C,UAAM,IAAI,iCAAiB,EAAE,SAAS,WAAW,iBAAiB,CAAC;AAAA,EACrE;AACA,WAAS,qBAAqB,SAAS;AACvC,WAAS,aAAa,CAAC,YAAoB;AACzC,UAAM,IAAI,iCAAiB,EAAE,SAAS,WAAW,aAAa,CAAC;AAAA,EACjE;AAEA,WAAS,QAAQ;AAEjB,SAAO;AACT;;;AF3LO,SAASC,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,UAAM,gCAAQ,QAAQ,OAAO;AAAA,IACnC;AAAA,EACF,CAAC;AACH;AAKO,IAAM,kBAAkBA,uBAAsB;","names":["createVertexAnthropic","import_provider_utils","createVertexAnthropic"]}
|
|
1
|
+
{"version":3,"sources":["../../src/anthropic/index.ts","../../src/anthropic/google-vertex-anthropic-provider-node.ts","../../src/google-vertex-auth-google-auth-library.ts","../../src/anthropic/google-vertex-anthropic-provider.ts"],"sourcesContent":["export {\n vertexAnthropic,\n createVertexAnthropic,\n} from './google-vertex-anthropic-provider-node';\nexport type {\n GoogleVertexAnthropicProvider,\n GoogleVertexAnthropicProviderSettings,\n} from './google-vertex-anthropic-provider-node';\n","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, ...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;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;;;ACAA,IAAAC,yBAAwB;;;ACAxB,iCAA8C;AAE9C,IAAI,eAAkC;AACtC,IAAI,cAAwC;AAE5C,SAAS,QAAQ,SAA4B;AAC3C,MAAI,CAAC,gB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AAiD,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,UAAM,gCAAQ,QAAQ,OAAO;AAAA,IACnC;AAAA,EACF,CAAC;AACH;AAKO,IAAM,kBAAkBA,uBAAsB;","names":["createVertexAnthropic","import_provider_utils","createVertexAnthropic"]}
|
package/dist/anthropic/index.mjs
CHANGED
|
@@ -85,7 +85,27 @@ var vertexAnthropicTools = {
|
|
|
85
85
|
/**
|
|
86
86
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
87
87
|
*/
|
|
88
|
-
webSearch_20250305: anthropicTools.webSearch_20250305
|
|
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
|
|
89
109
|
};
|
|
90
110
|
function createVertexAnthropic(options = {}) {
|
|
91
111
|
const getBaseURL = () => {
|
|
@@ -118,7 +138,9 @@ function createVertexAnthropic(options = {}) {
|
|
|
118
138
|
// Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion
|
|
119
139
|
supportedUrls: () => ({}),
|
|
120
140
|
// force the use of JSON tool fallback for structured outputs since beta header isn't supported
|
|
121
|
-
supportsNativeStructuredOutput: false
|
|
141
|
+
supportsNativeStructuredOutput: false,
|
|
142
|
+
// Vertex Anthropic doesn't support strict mode on tool definitions.
|
|
143
|
+
supportsStrictTools: false
|
|
122
144
|
});
|
|
123
145
|
};
|
|
124
146
|
const provider = function(modelId) {
|
|
@@ -129,7 +151,7 @@ function createVertexAnthropic(options = {}) {
|
|
|
129
151
|
}
|
|
130
152
|
return createChatModel(modelId);
|
|
131
153
|
};
|
|
132
|
-
provider.specificationVersion = "
|
|
154
|
+
provider.specificationVersion = "v4";
|
|
133
155
|
provider.languageModel = createChatModel;
|
|
134
156
|
provider.chat = createChatModel;
|
|
135
157
|
provider.messages = createChatModel;
|
|
@@ -1 +1 @@
|
|
|
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\n 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 LanguageModelV3,\n NoSuchModelError,\n ProviderV3,\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};\nexport interface GoogleVertexAnthropicProvider extends ProviderV3 {\n /**\n * Creates a model for text generation.\n */\n (modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV3;\n\n /**\n * Creates a model for text generation.\n */\n languageModel(modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV3;\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\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, ...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 });\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 = 'v3' 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;A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A,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;;;AF3LO,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
|
+
{"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, ...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;AAA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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"]}
|
package/dist/edge/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EmbeddingModelV4, ProviderV4, LanguageModelV4, ImageModelV4, Experimental_VideoModelV4 } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
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' | (string & {});
|
|
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
6
|
|
|
7
7
|
interface GoogleVertexConfig {
|
|
8
8
|
provider: string;
|
|
@@ -11,15 +11,15 @@ interface GoogleVertexConfig {
|
|
|
11
11
|
fetch?: FetchFunction;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
declare class GoogleVertexEmbeddingModel implements
|
|
15
|
-
readonly specificationVersion = "
|
|
14
|
+
declare class GoogleVertexEmbeddingModel implements EmbeddingModelV4 {
|
|
15
|
+
readonly specificationVersion = "v4";
|
|
16
16
|
readonly modelId: GoogleVertexEmbeddingModelId;
|
|
17
17
|
readonly maxEmbeddingsPerCall = 2048;
|
|
18
18
|
readonly supportsParallelCalls = true;
|
|
19
19
|
private readonly config;
|
|
20
20
|
get provider(): string;
|
|
21
21
|
constructor(modelId: GoogleVertexEmbeddingModelId, config: GoogleVertexConfig);
|
|
22
|
-
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<
|
|
22
|
+
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV4['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV4['doEmbed']>>>;
|
|
23
23
|
}
|
|
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' | 'gemini-3.1-flash-image-preview' | (string & {});
|
|
@@ -37,45 +37,45 @@ declare const googleVertexTools: {
|
|
|
37
37
|
startTime: string;
|
|
38
38
|
endTime: string;
|
|
39
39
|
} | undefined;
|
|
40
|
-
}>;
|
|
41
|
-
enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
|
|
42
|
-
googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
|
|
43
|
-
urlContext: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
|
|
40
|
+
}, {}>;
|
|
41
|
+
enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
|
|
42
|
+
googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
|
|
43
|
+
urlContext: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
|
|
44
44
|
fileSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
|
|
45
45
|
[x: string]: unknown;
|
|
46
46
|
fileSearchStoreNames: string[];
|
|
47
47
|
topK?: number | undefined;
|
|
48
48
|
metadataFilter?: string | undefined;
|
|
49
|
-
}>;
|
|
49
|
+
}, {}>;
|
|
50
50
|
codeExecution: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
51
51
|
language: string;
|
|
52
52
|
code: string;
|
|
53
53
|
}, {
|
|
54
54
|
outcome: string;
|
|
55
55
|
output: string;
|
|
56
|
-
}, {}>;
|
|
56
|
+
}, {}, {}>;
|
|
57
57
|
vertexRagStore: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
|
|
58
58
|
ragCorpus: string;
|
|
59
59
|
topK?: number;
|
|
60
|
-
}>;
|
|
60
|
+
}, {}>;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
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
64
|
|
|
65
|
-
interface GoogleVertexProvider extends
|
|
65
|
+
interface GoogleVertexProvider extends ProviderV4 {
|
|
66
66
|
/**
|
|
67
67
|
* Creates a model for text generation.
|
|
68
68
|
*/
|
|
69
|
-
(modelId: GoogleVertexModelId):
|
|
70
|
-
languageModel: (modelId: GoogleVertexModelId) =>
|
|
69
|
+
(modelId: GoogleVertexModelId): LanguageModelV4;
|
|
70
|
+
languageModel: (modelId: GoogleVertexModelId) => LanguageModelV4;
|
|
71
71
|
/**
|
|
72
72
|
* Creates a model for image generation.
|
|
73
73
|
*/
|
|
74
|
-
image(modelId: GoogleVertexImageModelId):
|
|
74
|
+
image(modelId: GoogleVertexImageModelId): ImageModelV4;
|
|
75
75
|
/**
|
|
76
76
|
* Creates a model for image generation.
|
|
77
77
|
*/
|
|
78
|
-
imageModel(modelId: GoogleVertexImageModelId):
|
|
78
|
+
imageModel(modelId: GoogleVertexImageModelId): ImageModelV4;
|
|
79
79
|
tools: typeof googleVertexTools;
|
|
80
80
|
/**
|
|
81
81
|
* @deprecated Use `embeddingModel` instead.
|
|
@@ -84,11 +84,11 @@ interface GoogleVertexProvider extends ProviderV3 {
|
|
|
84
84
|
/**
|
|
85
85
|
* Creates a model for video generation.
|
|
86
86
|
*/
|
|
87
|
-
video(modelId: GoogleVertexVideoModelId):
|
|
87
|
+
video(modelId: GoogleVertexVideoModelId): Experimental_VideoModelV4;
|
|
88
88
|
/**
|
|
89
89
|
* Creates a model for video generation.
|
|
90
90
|
*/
|
|
91
|
-
videoModel(modelId: GoogleVertexVideoModelId):
|
|
91
|
+
videoModel(modelId: GoogleVertexVideoModelId): Experimental_VideoModelV4;
|
|
92
92
|
}
|
|
93
93
|
interface GoogleVertexProviderSettings$1 {
|
|
94
94
|
/**
|
package/dist/edge/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EmbeddingModelV4, ProviderV4, LanguageModelV4, ImageModelV4, Experimental_VideoModelV4 } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
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' | (string & {});
|
|
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
6
|
|
|
7
7
|
interface GoogleVertexConfig {
|
|
8
8
|
provider: string;
|
|
@@ -11,15 +11,15 @@ interface GoogleVertexConfig {
|
|
|
11
11
|
fetch?: FetchFunction;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
declare class GoogleVertexEmbeddingModel implements
|
|
15
|
-
readonly specificationVersion = "
|
|
14
|
+
declare class GoogleVertexEmbeddingModel implements EmbeddingModelV4 {
|
|
15
|
+
readonly specificationVersion = "v4";
|
|
16
16
|
readonly modelId: GoogleVertexEmbeddingModelId;
|
|
17
17
|
readonly maxEmbeddingsPerCall = 2048;
|
|
18
18
|
readonly supportsParallelCalls = true;
|
|
19
19
|
private readonly config;
|
|
20
20
|
get provider(): string;
|
|
21
21
|
constructor(modelId: GoogleVertexEmbeddingModelId, config: GoogleVertexConfig);
|
|
22
|
-
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<
|
|
22
|
+
doEmbed({ values, headers, abortSignal, providerOptions, }: Parameters<EmbeddingModelV4['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV4['doEmbed']>>>;
|
|
23
23
|
}
|
|
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' | 'gemini-3.1-flash-image-preview' | (string & {});
|
|
@@ -37,45 +37,45 @@ declare const googleVertexTools: {
|
|
|
37
37
|
startTime: string;
|
|
38
38
|
endTime: string;
|
|
39
39
|
} | undefined;
|
|
40
|
-
}>;
|
|
41
|
-
enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
|
|
42
|
-
googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
|
|
43
|
-
urlContext: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
|
|
40
|
+
}, {}>;
|
|
41
|
+
enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
|
|
42
|
+
googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
|
|
43
|
+
urlContext: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}, {}>;
|
|
44
44
|
fileSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
|
|
45
45
|
[x: string]: unknown;
|
|
46
46
|
fileSearchStoreNames: string[];
|
|
47
47
|
topK?: number | undefined;
|
|
48
48
|
metadataFilter?: string | undefined;
|
|
49
|
-
}>;
|
|
49
|
+
}, {}>;
|
|
50
50
|
codeExecution: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
51
51
|
language: string;
|
|
52
52
|
code: string;
|
|
53
53
|
}, {
|
|
54
54
|
outcome: string;
|
|
55
55
|
output: string;
|
|
56
|
-
}, {}>;
|
|
56
|
+
}, {}, {}>;
|
|
57
57
|
vertexRagStore: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
|
|
58
58
|
ragCorpus: string;
|
|
59
59
|
topK?: number;
|
|
60
|
-
}>;
|
|
60
|
+
}, {}>;
|
|
61
61
|
};
|
|
62
62
|
|
|
63
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
64
|
|
|
65
|
-
interface GoogleVertexProvider extends
|
|
65
|
+
interface GoogleVertexProvider extends ProviderV4 {
|
|
66
66
|
/**
|
|
67
67
|
* Creates a model for text generation.
|
|
68
68
|
*/
|
|
69
|
-
(modelId: GoogleVertexModelId):
|
|
70
|
-
languageModel: (modelId: GoogleVertexModelId) =>
|
|
69
|
+
(modelId: GoogleVertexModelId): LanguageModelV4;
|
|
70
|
+
languageModel: (modelId: GoogleVertexModelId) => LanguageModelV4;
|
|
71
71
|
/**
|
|
72
72
|
* Creates a model for image generation.
|
|
73
73
|
*/
|
|
74
|
-
image(modelId: GoogleVertexImageModelId):
|
|
74
|
+
image(modelId: GoogleVertexImageModelId): ImageModelV4;
|
|
75
75
|
/**
|
|
76
76
|
* Creates a model for image generation.
|
|
77
77
|
*/
|
|
78
|
-
imageModel(modelId: GoogleVertexImageModelId):
|
|
78
|
+
imageModel(modelId: GoogleVertexImageModelId): ImageModelV4;
|
|
79
79
|
tools: typeof googleVertexTools;
|
|
80
80
|
/**
|
|
81
81
|
* @deprecated Use `embeddingModel` instead.
|
|
@@ -84,11 +84,11 @@ interface GoogleVertexProvider extends ProviderV3 {
|
|
|
84
84
|
/**
|
|
85
85
|
* Creates a model for video generation.
|
|
86
86
|
*/
|
|
87
|
-
video(modelId: GoogleVertexVideoModelId):
|
|
87
|
+
video(modelId: GoogleVertexVideoModelId): Experimental_VideoModelV4;
|
|
88
88
|
/**
|
|
89
89
|
* Creates a model for video generation.
|
|
90
90
|
*/
|
|
91
|
-
videoModel(modelId: GoogleVertexVideoModelId):
|
|
91
|
+
videoModel(modelId: GoogleVertexVideoModelId): Experimental_VideoModelV4;
|
|
92
92
|
}
|
|
93
93
|
interface GoogleVertexProviderSettings$1 {
|
|
94
94
|
/**
|