@ai-sdk/google-vertex 5.0.0-beta.5 → 5.0.0-beta.52
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 +430 -8
- package/README.md +65 -1
- package/dist/anthropic/edge/index.d.ts +61 -16
- package/dist/anthropic/edge/index.js +67 -60
- package/dist/anthropic/edge/index.js.map +1 -1
- package/dist/anthropic/index.d.ts +61 -16
- package/dist/anthropic/index.js +57 -55
- package/dist/anthropic/index.js.map +1 -1
- package/dist/edge/index.d.ts +31 -22
- package/dist/edge/index.js +217 -176
- package/dist/edge/index.js.map +1 -1
- package/dist/index.d.ts +31 -22
- package/dist/index.js +208 -173
- package/dist/index.js.map +1 -1
- package/dist/maas/edge/index.d.ts +76 -0
- package/dist/maas/edge/index.js +196 -0
- package/dist/maas/edge/index.js.map +1 -0
- package/dist/maas/index.d.ts +60 -0
- package/dist/maas/index.js +101 -0
- package/dist/maas/index.js.map +1 -0
- package/docs/16-google-vertex.mdx +226 -6
- package/maas/edge.d.ts +1 -0
- package/maas/index.d.ts +1 -0
- package/package.json +29 -18
- package/src/anthropic/edge/google-vertex-anthropic-provider-edge.ts +1 -2
- package/src/anthropic/google-vertex-anthropic-messages-options.ts +1 -0
- package/src/anthropic/google-vertex-anthropic-provider-node.ts +1 -2
- package/src/anthropic/google-vertex-anthropic-provider.ts +33 -8
- package/src/edge/google-vertex-provider-edge.ts +1 -2
- package/src/google-vertex-config.ts +1 -1
- package/src/google-vertex-embedding-model.ts +23 -6
- package/src/google-vertex-embedding-options.ts +2 -0
- package/src/google-vertex-image-model.ts +38 -18
- package/src/google-vertex-options.ts +0 -1
- 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
- package/dist/anthropic/edge/index.d.mts +0 -231
- package/dist/anthropic/edge/index.mjs +0 -259
- package/dist/anthropic/edge/index.mjs.map +0 -1
- package/dist/anthropic/index.d.mts +0 -215
- package/dist/anthropic/index.mjs +0 -164
- package/dist/anthropic/index.mjs.map +0 -1
- package/dist/edge/index.d.mts +0 -160
- package/dist/edge/index.mjs +0 -1049
- package/dist/edge/index.mjs.map +0 -1
- package/dist/index.d.mts +0 -219
- package/dist/index.mjs +0 -960
- package/dist/index.mjs.map +0 -1
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { GoogleAuthOptions } from 'google-auth-library';
|
|
2
|
-
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
|
-
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
|
-
import { ProviderV3, LanguageModelV3 } from '@ai-sdk/provider';
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Tools supported by Google Vertex Anthropic.
|
|
10
|
-
* This is a subset of the full Anthropic tools - only these are recognized by the Vertex API.
|
|
11
|
-
*/
|
|
12
|
-
declare const vertexAnthropicTools: {
|
|
13
|
-
/**
|
|
14
|
-
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
15
|
-
* allowing system operations, script execution, and command-line automation.
|
|
16
|
-
*
|
|
17
|
-
* Image results are supported.
|
|
18
|
-
*/
|
|
19
|
-
bash_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
20
|
-
command: string;
|
|
21
|
-
restart?: boolean;
|
|
22
|
-
}, {}>;
|
|
23
|
-
/**
|
|
24
|
-
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
25
|
-
* allowing system operations, script execution, and command-line automation.
|
|
26
|
-
*
|
|
27
|
-
* Image results are supported.
|
|
28
|
-
*/
|
|
29
|
-
bash_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
30
|
-
command: string;
|
|
31
|
-
restart?: boolean;
|
|
32
|
-
}, {}>;
|
|
33
|
-
/**
|
|
34
|
-
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
35
|
-
* helping you debug, fix, and improve your code or other text documents.
|
|
36
|
-
*
|
|
37
|
-
* Supported models: Claude Sonnet 3.5
|
|
38
|
-
*/
|
|
39
|
-
textEditor_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
40
|
-
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
41
|
-
path: string;
|
|
42
|
-
file_text?: string;
|
|
43
|
-
insert_line?: number;
|
|
44
|
-
new_str?: string;
|
|
45
|
-
insert_text?: string;
|
|
46
|
-
old_str?: string;
|
|
47
|
-
view_range?: number[];
|
|
48
|
-
}, {}>;
|
|
49
|
-
/**
|
|
50
|
-
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
51
|
-
* helping you debug, fix, and improve your code or other text documents.
|
|
52
|
-
*
|
|
53
|
-
* Supported models: Claude Sonnet 3.7
|
|
54
|
-
*/
|
|
55
|
-
textEditor_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
56
|
-
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
57
|
-
path: string;
|
|
58
|
-
file_text?: string;
|
|
59
|
-
insert_line?: number;
|
|
60
|
-
new_str?: string;
|
|
61
|
-
insert_text?: string;
|
|
62
|
-
old_str?: string;
|
|
63
|
-
view_range?: number[];
|
|
64
|
-
}, {}>;
|
|
65
|
-
/**
|
|
66
|
-
* Claude can use an Anthropic-defined text editor tool to view and modify text files.
|
|
67
|
-
* Note: This version does not support the "undo_edit" command.
|
|
68
|
-
* @deprecated Use textEditor_20250728 instead
|
|
69
|
-
*/
|
|
70
|
-
textEditor_20250429: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
71
|
-
command: "view" | "create" | "str_replace" | "insert";
|
|
72
|
-
path: string;
|
|
73
|
-
file_text?: string;
|
|
74
|
-
insert_line?: number;
|
|
75
|
-
new_str?: string;
|
|
76
|
-
insert_text?: string;
|
|
77
|
-
old_str?: string;
|
|
78
|
-
view_range?: number[];
|
|
79
|
-
}, {}>;
|
|
80
|
-
/**
|
|
81
|
-
* Claude can use an Anthropic-defined text editor tool to view and modify text files.
|
|
82
|
-
* Note: This version does not support the "undo_edit" command and adds optional max_characters parameter.
|
|
83
|
-
* Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1
|
|
84
|
-
*/
|
|
85
|
-
textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactory<{
|
|
86
|
-
command: "view" | "create" | "str_replace" | "insert";
|
|
87
|
-
path: string;
|
|
88
|
-
file_text?: string;
|
|
89
|
-
insert_line?: number;
|
|
90
|
-
new_str?: string;
|
|
91
|
-
insert_text?: string;
|
|
92
|
-
old_str?: string;
|
|
93
|
-
view_range?: number[];
|
|
94
|
-
}, {
|
|
95
|
-
maxCharacters?: number;
|
|
96
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
97
|
-
command: "view" | "create" | "str_replace" | "insert";
|
|
98
|
-
path: string;
|
|
99
|
-
file_text?: string;
|
|
100
|
-
insert_line?: number;
|
|
101
|
-
new_str?: string;
|
|
102
|
-
insert_text?: string;
|
|
103
|
-
old_str?: string;
|
|
104
|
-
view_range?: number[];
|
|
105
|
-
}, unknown>;
|
|
106
|
-
/**
|
|
107
|
-
* Claude can interact with computer environments through the computer use tool, which
|
|
108
|
-
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
109
|
-
*
|
|
110
|
-
* Image results are supported.
|
|
111
|
-
*/
|
|
112
|
-
computer_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
113
|
-
action: "key" | "type" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
|
|
114
|
-
coordinate?: number[];
|
|
115
|
-
text?: string;
|
|
116
|
-
}, {
|
|
117
|
-
displayWidthPx: number;
|
|
118
|
-
displayHeightPx: number;
|
|
119
|
-
displayNumber?: number;
|
|
120
|
-
}>;
|
|
121
|
-
/**
|
|
122
|
-
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
123
|
-
*/
|
|
124
|
-
webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
125
|
-
query: string;
|
|
126
|
-
}, {
|
|
127
|
-
type: "web_search_result";
|
|
128
|
-
url: string;
|
|
129
|
-
title: string | null;
|
|
130
|
-
pageAge: string | null;
|
|
131
|
-
encryptedContent: string;
|
|
132
|
-
}[], {
|
|
133
|
-
maxUses?: number;
|
|
134
|
-
allowedDomains?: string[];
|
|
135
|
-
blockedDomains?: string[];
|
|
136
|
-
userLocation?: {
|
|
137
|
-
type: "approximate";
|
|
138
|
-
city?: string;
|
|
139
|
-
region?: string;
|
|
140
|
-
country?: string;
|
|
141
|
-
timezone?: string;
|
|
142
|
-
};
|
|
143
|
-
}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
144
|
-
query: string;
|
|
145
|
-
}, {
|
|
146
|
-
type: "web_search_result";
|
|
147
|
-
url: string;
|
|
148
|
-
title: string | null;
|
|
149
|
-
pageAge: string | null;
|
|
150
|
-
encryptedContent: string;
|
|
151
|
-
}[]>;
|
|
152
|
-
};
|
|
153
|
-
interface GoogleVertexAnthropicProvider extends ProviderV3 {
|
|
154
|
-
/**
|
|
155
|
-
* Creates a model for text generation.
|
|
156
|
-
*/
|
|
157
|
-
(modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV3;
|
|
158
|
-
/**
|
|
159
|
-
* Creates a model for text generation.
|
|
160
|
-
*/
|
|
161
|
-
languageModel(modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV3;
|
|
162
|
-
/**
|
|
163
|
-
* Anthropic tools supported by Google Vertex.
|
|
164
|
-
* Note: Only a subset of Anthropic tools are available on Vertex.
|
|
165
|
-
* Supported tools: bash_20241022, bash_20250124, textEditor_20241022,
|
|
166
|
-
* textEditor_20250124, textEditor_20250429, textEditor_20250728,
|
|
167
|
-
* computer_20241022, webSearch_20250305
|
|
168
|
-
*/
|
|
169
|
-
tools: typeof vertexAnthropicTools;
|
|
170
|
-
/**
|
|
171
|
-
* @deprecated Use `embeddingModel` instead.
|
|
172
|
-
*/
|
|
173
|
-
textEmbeddingModel(modelId: string): never;
|
|
174
|
-
}
|
|
175
|
-
interface GoogleVertexAnthropicProviderSettings$1 {
|
|
176
|
-
/**
|
|
177
|
-
* Google Cloud project ID. Defaults to the value of the `GOOGLE_VERTEX_PROJECT` environment variable.
|
|
178
|
-
*/
|
|
179
|
-
project?: string;
|
|
180
|
-
/**
|
|
181
|
-
* Google Cloud region. Defaults to the value of the `GOOGLE_VERTEX_LOCATION` environment variable.
|
|
182
|
-
*/
|
|
183
|
-
location?: string;
|
|
184
|
-
/**
|
|
185
|
-
* Use a different URL prefix for API calls, e.g. to use proxy servers.
|
|
186
|
-
* The default prefix is `https://api.anthropic.com/v1`.
|
|
187
|
-
*/
|
|
188
|
-
baseURL?: string;
|
|
189
|
-
/**
|
|
190
|
-
* Custom headers to include in the requests.
|
|
191
|
-
*/
|
|
192
|
-
headers?: Resolvable<Record<string, string | undefined>>;
|
|
193
|
-
/**
|
|
194
|
-
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
195
|
-
* or to provide a custom fetch implementation for e.g. testing.
|
|
196
|
-
*/
|
|
197
|
-
fetch?: FetchFunction;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
interface GoogleVertexAnthropicProviderSettings extends GoogleVertexAnthropicProviderSettings$1 {
|
|
201
|
-
/**
|
|
202
|
-
* Optional. The Authentication options provided by google-auth-library.
|
|
203
|
-
* Complete list of authentication options is documented in the
|
|
204
|
-
* GoogleAuthOptions interface:
|
|
205
|
-
* https://github.com/googleapis/google-auth-library-nodejs/blob/main/src/auth/googleauth.ts.
|
|
206
|
-
*/
|
|
207
|
-
googleAuthOptions?: GoogleAuthOptions;
|
|
208
|
-
}
|
|
209
|
-
declare function createVertexAnthropic(options?: GoogleVertexAnthropicProviderSettings): GoogleVertexAnthropicProvider;
|
|
210
|
-
/**
|
|
211
|
-
* Default Google Vertex Anthropic provider instance.
|
|
212
|
-
*/
|
|
213
|
-
declare const vertexAnthropic: GoogleVertexAnthropicProvider;
|
|
214
|
-
|
|
215
|
-
export { type GoogleVertexAnthropicProvider, type GoogleVertexAnthropicProviderSettings, createVertexAnthropic, vertexAnthropic };
|
package/dist/anthropic/index.mjs
DELETED
|
@@ -1,164 +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
|
-
function createVertexAnthropic(options = {}) {
|
|
91
|
-
const getBaseURL = () => {
|
|
92
|
-
var _a;
|
|
93
|
-
const location = loadOptionalSetting({
|
|
94
|
-
settingValue: options.location,
|
|
95
|
-
environmentVariableName: "GOOGLE_VERTEX_LOCATION"
|
|
96
|
-
});
|
|
97
|
-
const project = loadOptionalSetting({
|
|
98
|
-
settingValue: options.project,
|
|
99
|
-
environmentVariableName: "GOOGLE_VERTEX_PROJECT"
|
|
100
|
-
});
|
|
101
|
-
return (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : `https://${location === "global" ? "" : location + "-"}aiplatform.googleapis.com/v1/projects/${project}/locations/${location}/publishers/anthropic/models`;
|
|
102
|
-
};
|
|
103
|
-
const createChatModel = (modelId) => {
|
|
104
|
-
var _a;
|
|
105
|
-
return new AnthropicMessagesLanguageModel(modelId, {
|
|
106
|
-
provider: "vertex.anthropic.messages",
|
|
107
|
-
baseURL: getBaseURL(),
|
|
108
|
-
headers: (_a = options.headers) != null ? _a : {},
|
|
109
|
-
fetch: options.fetch,
|
|
110
|
-
buildRequestUrl: (baseURL, isStreaming) => `${baseURL}/${modelId}:${isStreaming ? "streamRawPredict" : "rawPredict"}`,
|
|
111
|
-
transformRequestBody: (args) => {
|
|
112
|
-
const { model, ...rest } = args;
|
|
113
|
-
return {
|
|
114
|
-
...rest,
|
|
115
|
-
anthropic_version: "vertex-2023-10-16"
|
|
116
|
-
};
|
|
117
|
-
},
|
|
118
|
-
// Google Vertex Anthropic doesn't support URL sources, force download and base64 conversion
|
|
119
|
-
supportedUrls: () => ({}),
|
|
120
|
-
// force the use of JSON tool fallback for structured outputs since beta header isn't supported
|
|
121
|
-
supportsNativeStructuredOutput: false
|
|
122
|
-
});
|
|
123
|
-
};
|
|
124
|
-
const provider = function(modelId) {
|
|
125
|
-
if (new.target) {
|
|
126
|
-
throw new Error(
|
|
127
|
-
"The Anthropic model function cannot be called with the new keyword."
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
return createChatModel(modelId);
|
|
131
|
-
};
|
|
132
|
-
provider.specificationVersion = "v3";
|
|
133
|
-
provider.languageModel = createChatModel;
|
|
134
|
-
provider.chat = createChatModel;
|
|
135
|
-
provider.messages = createChatModel;
|
|
136
|
-
provider.embeddingModel = (modelId) => {
|
|
137
|
-
throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
|
|
138
|
-
};
|
|
139
|
-
provider.textEmbeddingModel = provider.embeddingModel;
|
|
140
|
-
provider.imageModel = (modelId) => {
|
|
141
|
-
throw new NoSuchModelError({ modelId, modelType: "imageModel" });
|
|
142
|
-
};
|
|
143
|
-
provider.tools = vertexAnthropicTools;
|
|
144
|
-
return provider;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// src/anthropic/google-vertex-anthropic-provider-node.ts
|
|
148
|
-
function createVertexAnthropic2(options = {}) {
|
|
149
|
-
return createVertexAnthropic({
|
|
150
|
-
...options,
|
|
151
|
-
headers: async () => ({
|
|
152
|
-
Authorization: `Bearer ${await generateAuthToken(
|
|
153
|
-
options.googleAuthOptions
|
|
154
|
-
)}`,
|
|
155
|
-
...await resolve(options.headers)
|
|
156
|
-
})
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
var vertexAnthropic = createVertexAnthropic2();
|
|
160
|
-
export {
|
|
161
|
-
createVertexAnthropic2 as createVertexAnthropic,
|
|
162
|
-
vertexAnthropic
|
|
163
|
-
};
|
|
164
|
-
//# 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\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":"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","names":["createVertexAnthropic"]}
|
package/dist/edge/index.d.mts
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { EmbeddingModelV3, ProviderV3, LanguageModelV3, ImageModelV3, Experimental_VideoModelV3 } 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' | (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 EmbeddingModelV3 {
|
|
15
|
-
readonly specificationVersion = "v3";
|
|
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<EmbeddingModelV3['doEmbed']>[0]): Promise<Awaited<ReturnType<EmbeddingModelV3['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 ProviderV3 {
|
|
66
|
-
/**
|
|
67
|
-
* Creates a model for text generation.
|
|
68
|
-
*/
|
|
69
|
-
(modelId: GoogleVertexModelId): LanguageModelV3;
|
|
70
|
-
languageModel: (modelId: GoogleVertexModelId) => LanguageModelV3;
|
|
71
|
-
/**
|
|
72
|
-
* Creates a model for image generation.
|
|
73
|
-
*/
|
|
74
|
-
image(modelId: GoogleVertexImageModelId): ImageModelV3;
|
|
75
|
-
/**
|
|
76
|
-
* Creates a model for image generation.
|
|
77
|
-
*/
|
|
78
|
-
imageModel(modelId: GoogleVertexImageModelId): ImageModelV3;
|
|
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_VideoModelV3;
|
|
88
|
-
/**
|
|
89
|
-
* Creates a model for video generation.
|
|
90
|
-
*/
|
|
91
|
-
videoModel(modelId: GoogleVertexVideoModelId): Experimental_VideoModelV3;
|
|
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 };
|