@ai-sdk/google-vertex 5.0.0-beta.45 → 5.0.0-beta.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/anthropic/edge/index.js +44 -59
- package/dist/anthropic/edge/index.js.map +1 -1
- package/dist/anthropic/index.js +34 -54
- package/dist/anthropic/index.js.map +1 -1
- package/dist/edge/index.js +184 -170
- package/dist/edge/index.js.map +1 -1
- package/dist/index.js +175 -167
- package/dist/index.js.map +1 -1
- package/dist/maas/edge/index.js +27 -46
- package/dist/maas/edge/index.js.map +1 -1
- package/dist/maas/index.js +17 -41
- package/dist/maas/index.js.map +1 -1
- package/package.json +20 -20
- package/dist/anthropic/edge/index.d.mts +0 -276
- package/dist/anthropic/edge/index.mjs +0 -281
- package/dist/anthropic/edge/index.mjs.map +0 -1
- package/dist/anthropic/index.d.mts +0 -260
- package/dist/anthropic/index.mjs +0 -186
- 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
- package/dist/maas/edge/index.d.mts +0 -76
- package/dist/maas/edge/index.mjs +0 -196
- package/dist/maas/edge/index.mjs.map +0 -1
- package/dist/maas/index.d.mts +0 -60
- package/dist/maas/index.mjs +0 -101
- package/dist/maas/index.mjs.map +0 -1
package/dist/maas/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/maas/
|
|
1
|
+
{"version":3,"sources":["../../src/maas/google-vertex-maas-provider-node.ts","../../src/google-vertex-auth-google-auth-library.ts","../../src/maas/google-vertex-maas-provider.ts"],"sourcesContent":["import { FetchFunction, resolve } from '@ai-sdk/provider-utils';\nimport { GoogleAuthOptions } from 'google-auth-library';\nimport { generateAuthToken } from '../google-vertex-auth-google-auth-library';\nimport {\n createVertexMaas as createVertexMaasOriginal,\n GoogleVertexMaasProvider,\n GoogleVertexMaasProviderSettings as GoogleVertexMaasProviderSettingsOriginal,\n} from './google-vertex-maas-provider';\n\nexport type { GoogleVertexMaasProvider };\n\nexport interface GoogleVertexMaasProviderSettings extends GoogleVertexMaasProviderSettingsOriginal {\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\n/**\n * Create a Google Vertex AI MaaS (Model as a Service) provider instance for Node.js.\n * Uses the OpenAI-compatible Chat Completions API for partner and open models.\n * Automatically handles Google Cloud authentication.\n *\n * @see https://cloud.google.com/vertex-ai/generative-ai/docs/maas/use-open-models\n */\nexport function createVertexMaas(\n options: GoogleVertexMaasProviderSettings = {},\n): GoogleVertexMaasProvider {\n // Create a custom fetch wrapper that adds auth headers\n const customFetch: FetchFunction = async (url, init) => {\n const token = await generateAuthToken(options.googleAuthOptions);\n const resolvedHeaders = await resolve(options.headers);\n const authHeaders = {\n ...resolvedHeaders,\n Authorization: `Bearer ${token}`,\n };\n\n // Merge auth headers with existing headers from init\n const fetchInit = {\n ...init,\n headers: {\n ...init?.headers,\n ...authHeaders,\n },\n };\n\n // Call the original fetch or user's custom fetch\n return (options.fetch ?? fetch)(url, fetchInit);\n };\n\n return createVertexMaasOriginal({\n ...options,\n fetch: customFetch,\n headers: undefined, // Don't pass headers, we handle them in fetch\n });\n}\n\n/**\n * Default Google Vertex AI MaaS provider instance for Node.js.\n */\nexport const vertexMaas = createVertexMaas();\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 { createOpenAICompatible } from '@ai-sdk/openai-compatible';\nimport type { OpenAICompatibleProvider } from '@ai-sdk/openai-compatible';\nimport {\n FetchFunction,\n loadOptionalSetting,\n loadSetting,\n Resolvable,\n withoutTrailingSlash,\n} from '@ai-sdk/provider-utils';\nimport type { GoogleVertexMaasModelId } from './google-vertex-maas-options';\n\nexport interface GoogleVertexMaasProvider extends OpenAICompatibleProvider<\n GoogleVertexMaasModelId,\n string,\n string,\n string\n> {}\n\nexport interface GoogleVertexMaasProviderSettings {\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 location/region. Defaults to the value of the `GOOGLE_VERTEX_LOCATION` environment variable.\n * Use 'global' for the global endpoint.\n */\n location?: string;\n\n /**\n * Base URL for the API calls. If not provided, will be constructed from project and location.\n */\n baseURL?: string;\n\n /**\n * Headers to use for requests. Can be:\n * - A headers object\n * - A Promise that resolves to a headers object\n * - A function that returns a headers object\n * - A function that returns a Promise of a headers object\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 AI MaaS (Model as a Service) provider instance.\n * Uses the OpenAI-compatible Chat Completions API for partner and open models.\n *\n * @see https://cloud.google.com/vertex-ai/generative-ai/docs/maas/use-open-models\n */\nexport function createVertexMaas(\n options: GoogleVertexMaasProviderSettings = {},\n): GoogleVertexMaasProvider {\n // Lazy-load settings to support loading from environment variables at runtime\n const loadLocation = () =>\n loadOptionalSetting({\n settingValue: options.location,\n environmentVariableName: 'GOOGLE_VERTEX_LOCATION',\n });\n\n const loadProject = () =>\n loadSetting({\n settingValue: options.project,\n settingName: 'project',\n environmentVariableName: 'GOOGLE_VERTEX_PROJECT',\n description: 'Google Vertex project',\n });\n\n // Construct base URL: https://aiplatform.googleapis.com/v1/projects/{project}/locations/{location}/endpoints/openapi\n const constructBaseURL = () => {\n const projectId = loadProject();\n const location = loadLocation() ?? 'global';\n\n return `https://aiplatform.googleapis.com/v1/projects/${projectId}/locations/${location}/endpoints/openapi`;\n };\n\n const loadBaseURL = () =>\n withoutTrailingSlash(options.baseURL ?? '') || constructBaseURL();\n\n let cachedProvider: GoogleVertexMaasProvider | undefined;\n const getProvider = () =>\n (cachedProvider ??= createOpenAICompatible({\n name: 'vertex.maas',\n baseURL: loadBaseURL(),\n fetch: options.fetch,\n }));\n\n const provider = (modelId: GoogleVertexMaasModelId) => getProvider()(modelId);\n\n provider.specificationVersion = 'v4' as const;\n provider.languageModel = (modelId: GoogleVertexMaasModelId) =>\n getProvider().languageModel(modelId);\n provider.chatModel = (modelId: GoogleVertexMaasModelId) =>\n getProvider().chatModel(modelId);\n provider.completionModel = (modelId: string) =>\n getProvider().completionModel(modelId);\n provider.embeddingModel = (modelId: string) =>\n getProvider().embeddingModel(modelId);\n provider.textEmbeddingModel = (modelId: string) =>\n getProvider().textEmbeddingModel(modelId);\n provider.imageModel = (modelId: string) => getProvider().imageModel(modelId);\n\n return provider as GoogleVertexMaasProvider;\n}\n"],"mappings":";AAAA,SAAwB,eAAe;;;ACAvC,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,SAAS,8BAA8B;AAEvC;AAAA,EAEE;AAAA,EACA;AAAA,EAEA;AAAA,OACK;AAiDA,SAAS,iBACd,UAA4C,CAAC,GACnB;AAE1B,QAAM,eAAe,MACnB,oBAAoB;AAAA,IAClB,cAAc,QAAQ;AAAA,IACtB,yBAAyB;AAAA,EAC3B,CAAC;AAEH,QAAM,cAAc,MAClB,YAAY;AAAA,IACV,cAAc,QAAQ;AAAA,IACtB,aAAa;AAAA,IACb,yBAAyB;AAAA,IACzB,aAAa;AAAA,EACf,CAAC;AAGH,QAAM,mBAAmB,MAAM;AA5EjC;AA6EI,UAAM,YAAY,YAAY;AAC9B,UAAM,YAAW,kBAAa,MAAb,YAAkB;AAEnC,WAAO,iDAAiD,SAAS,cAAc,QAAQ;AAAA,EACzF;AAEA,QAAM,cAAc,MAAG;AAnFzB;AAoFI,iCAAqB,aAAQ,YAAR,YAAmB,EAAE,KAAK,iBAAiB;AAAA;AAElE,MAAI;AACJ,QAAM,cAAc,MACjB,2DAAmB,uBAAuB;AAAA,IACzC,MAAM;AAAA,IACN,SAAS,YAAY;AAAA,IACrB,OAAO,QAAQ;AAAA,EACjB,CAAC;AAEH,QAAM,WAAW,CAAC,YAAqC,YAAY,EAAE,OAAO;AAE5E,WAAS,uBAAuB;AAChC,WAAS,gBAAgB,CAAC,YACxB,YAAY,EAAE,cAAc,OAAO;AACrC,WAAS,YAAY,CAAC,YACpB,YAAY,EAAE,UAAU,OAAO;AACjC,WAAS,kBAAkB,CAAC,YAC1B,YAAY,EAAE,gBAAgB,OAAO;AACvC,WAAS,iBAAiB,CAAC,YACzB,YAAY,EAAE,eAAe,OAAO;AACtC,WAAS,qBAAqB,CAAC,YAC7B,YAAY,EAAE,mBAAmB,OAAO;AAC1C,WAAS,aAAa,CAAC,YAAoB,YAAY,EAAE,WAAW,OAAO;AAE3E,SAAO;AACT;;;AFlFO,SAASA,kBACd,UAA4C,CAAC,GACnB;AAE1B,QAAM,cAA6B,OAAO,KAAK,SAAS;AAhC1D;AAiCI,UAAM,QAAQ,MAAM,kBAAkB,QAAQ,iBAAiB;AAC/D,UAAM,kBAAkB,MAAM,QAAQ,QAAQ,OAAO;AACrD,UAAM,cAAc;AAAA,MAClB,GAAG;AAAA,MACH,eAAe,UAAU,KAAK;AAAA,IAChC;AAGA,UAAM,YAAY;AAAA,MAChB,GAAG;AAAA,MACH,SAAS;AAAA,QACP,GAAG,6BAAM;AAAA,QACT,GAAG;AAAA,MACL;AAAA,IACF;AAGA,aAAQ,aAAQ,UAAR,YAAiB,OAAO,KAAK,SAAS;AAAA,EAChD;AAEA,SAAO,iBAAyB;AAAA,IAC9B,GAAG;AAAA,IACH,OAAO;AAAA,IACP,SAAS;AAAA;AAAA,EACX,CAAC;AACH;AAKO,IAAM,aAAaA,kBAAiB;","names":["createVertexMaas"]}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/google-vertex",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.47",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"license": "Apache-2.0",
|
|
5
6
|
"sideEffects": false,
|
|
6
7
|
"main": "./dist/index.js",
|
|
7
|
-
"module": "./dist/index.mjs",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/**/*",
|
|
@@ -29,49 +29,49 @@
|
|
|
29
29
|
"./package.json": "./package.json",
|
|
30
30
|
".": {
|
|
31
31
|
"types": "./dist/index.d.ts",
|
|
32
|
-
"import": "./dist/index.
|
|
33
|
-
"
|
|
32
|
+
"import": "./dist/index.js",
|
|
33
|
+
"default": "./dist/index.js"
|
|
34
34
|
},
|
|
35
35
|
"./edge": {
|
|
36
36
|
"types": "./dist/edge/index.d.ts",
|
|
37
|
-
"import": "./dist/edge/index.
|
|
38
|
-
"
|
|
37
|
+
"import": "./dist/edge/index.js",
|
|
38
|
+
"default": "./dist/edge/index.js"
|
|
39
39
|
},
|
|
40
40
|
"./anthropic": {
|
|
41
41
|
"types": "./dist/anthropic/index.d.ts",
|
|
42
|
-
"import": "./dist/anthropic/index.
|
|
43
|
-
"
|
|
42
|
+
"import": "./dist/anthropic/index.js",
|
|
43
|
+
"default": "./dist/anthropic/index.js"
|
|
44
44
|
},
|
|
45
45
|
"./anthropic/edge": {
|
|
46
46
|
"types": "./dist/anthropic/edge/index.d.ts",
|
|
47
|
-
"import": "./dist/anthropic/edge/index.
|
|
48
|
-
"
|
|
47
|
+
"import": "./dist/anthropic/edge/index.js",
|
|
48
|
+
"default": "./dist/anthropic/edge/index.js"
|
|
49
49
|
},
|
|
50
50
|
"./maas": {
|
|
51
51
|
"types": "./dist/maas/index.d.ts",
|
|
52
|
-
"import": "./dist/maas/index.
|
|
53
|
-
"
|
|
52
|
+
"import": "./dist/maas/index.js",
|
|
53
|
+
"default": "./dist/maas/index.js"
|
|
54
54
|
},
|
|
55
55
|
"./maas/edge": {
|
|
56
56
|
"types": "./dist/maas/edge/index.d.ts",
|
|
57
|
-
"import": "./dist/maas/edge/index.
|
|
58
|
-
"
|
|
57
|
+
"import": "./dist/maas/edge/index.js",
|
|
58
|
+
"default": "./dist/maas/edge/index.js"
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"google-auth-library": "^10.5.0",
|
|
63
|
-
"@ai-sdk/anthropic": "4.0.0-beta.
|
|
64
|
-
"@ai-sdk/google": "4.0.0-beta.
|
|
65
|
-
"@ai-sdk/openai-compatible": "3.0.0-beta.
|
|
66
|
-
"@ai-sdk/provider": "4.0.0-beta.
|
|
67
|
-
"@ai-sdk/provider-utils": "5.0.0-beta.
|
|
63
|
+
"@ai-sdk/anthropic": "4.0.0-beta.27",
|
|
64
|
+
"@ai-sdk/google": "4.0.0-beta.37",
|
|
65
|
+
"@ai-sdk/openai-compatible": "3.0.0-beta.24",
|
|
66
|
+
"@ai-sdk/provider": "4.0.0-beta.11",
|
|
67
|
+
"@ai-sdk/provider-utils": "5.0.0-beta.19"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@types/node": "20.17.24",
|
|
71
71
|
"tsup": "^8",
|
|
72
72
|
"typescript": "5.8.3",
|
|
73
73
|
"zod": "3.25.76",
|
|
74
|
-
"@ai-sdk/test-server": "2.0.0-beta.
|
|
74
|
+
"@ai-sdk/test-server": "2.0.0-beta.1",
|
|
75
75
|
"@vercel/ai-tsconfig": "0.0.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
2
|
-
import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
-
import { ProviderV4, LanguageModelV4 } from '@ai-sdk/provider';
|
|
4
|
-
|
|
5
|
-
interface GoogleCredentials {
|
|
6
|
-
/**
|
|
7
|
-
* The client email for the Google Cloud service account. Defaults to the
|
|
8
|
-
* value of the `GOOGLE_CLIENT_EMAIL` environment variable.
|
|
9
|
-
*/
|
|
10
|
-
clientEmail: string;
|
|
11
|
-
/**
|
|
12
|
-
* The private key for the Google Cloud service account. Defaults to the
|
|
13
|
-
* value of the `GOOGLE_PRIVATE_KEY` environment variable.
|
|
14
|
-
*/
|
|
15
|
-
privateKey: string;
|
|
16
|
-
/**
|
|
17
|
-
* Optional. The private key ID for the Google Cloud service account. Defaults
|
|
18
|
-
* to the value of the `GOOGLE_PRIVATE_KEY_ID` environment variable.
|
|
19
|
-
*/
|
|
20
|
-
privateKeyId?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
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 & {});
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Tools supported by Google Vertex Anthropic.
|
|
27
|
-
* This is a subset of the full Anthropic tools - only these are recognized by the Vertex API.
|
|
28
|
-
*/
|
|
29
|
-
declare const vertexAnthropicTools: {
|
|
30
|
-
/**
|
|
31
|
-
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
32
|
-
* allowing system operations, script execution, and command-line automation.
|
|
33
|
-
*
|
|
34
|
-
* Image results are supported.
|
|
35
|
-
*/
|
|
36
|
-
bash_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
37
|
-
command: string;
|
|
38
|
-
restart?: boolean;
|
|
39
|
-
}, {}, {}>;
|
|
40
|
-
/**
|
|
41
|
-
* The bash tool enables Claude to execute shell commands in a persistent bash session,
|
|
42
|
-
* allowing system operations, script execution, and command-line automation.
|
|
43
|
-
*
|
|
44
|
-
* Image results are supported.
|
|
45
|
-
*/
|
|
46
|
-
bash_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
47
|
-
command: string;
|
|
48
|
-
restart?: boolean;
|
|
49
|
-
}, {}, {}>;
|
|
50
|
-
/**
|
|
51
|
-
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
52
|
-
* helping you debug, fix, and improve your code or other text documents.
|
|
53
|
-
*
|
|
54
|
-
* Supported models: Claude Sonnet 3.5
|
|
55
|
-
*/
|
|
56
|
-
textEditor_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
57
|
-
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
58
|
-
path: string;
|
|
59
|
-
file_text?: string;
|
|
60
|
-
insert_line?: number;
|
|
61
|
-
new_str?: string;
|
|
62
|
-
insert_text?: string;
|
|
63
|
-
old_str?: string;
|
|
64
|
-
view_range?: number[];
|
|
65
|
-
}, {}, {}>;
|
|
66
|
-
/**
|
|
67
|
-
* Claude can use an Anthropic-defined text editor tool to view and modify text files,
|
|
68
|
-
* helping you debug, fix, and improve your code or other text documents.
|
|
69
|
-
*
|
|
70
|
-
* Supported models: Claude Sonnet 3.7
|
|
71
|
-
*/
|
|
72
|
-
textEditor_20250124: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
73
|
-
command: "view" | "create" | "str_replace" | "insert" | "undo_edit";
|
|
74
|
-
path: string;
|
|
75
|
-
file_text?: string;
|
|
76
|
-
insert_line?: number;
|
|
77
|
-
new_str?: string;
|
|
78
|
-
insert_text?: string;
|
|
79
|
-
old_str?: string;
|
|
80
|
-
view_range?: number[];
|
|
81
|
-
}, {}, {}>;
|
|
82
|
-
/**
|
|
83
|
-
* Claude can use an Anthropic-defined text editor tool to view and modify text files.
|
|
84
|
-
* Note: This version does not support the "undo_edit" command.
|
|
85
|
-
* @deprecated Use textEditor_20250728 instead
|
|
86
|
-
*/
|
|
87
|
-
textEditor_20250429: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
88
|
-
command: "view" | "create" | "str_replace" | "insert";
|
|
89
|
-
path: string;
|
|
90
|
-
file_text?: string;
|
|
91
|
-
insert_line?: number;
|
|
92
|
-
new_str?: string;
|
|
93
|
-
insert_text?: string;
|
|
94
|
-
old_str?: string;
|
|
95
|
-
view_range?: number[];
|
|
96
|
-
}, {}, {}>;
|
|
97
|
-
/**
|
|
98
|
-
* Claude can use an Anthropic-defined text editor tool to view and modify text files.
|
|
99
|
-
* Note: This version does not support the "undo_edit" command and adds optional max_characters parameter.
|
|
100
|
-
* Supported models: Claude Sonnet 4, Opus 4, and Opus 4.1
|
|
101
|
-
*/
|
|
102
|
-
textEditor_20250728: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactory<{
|
|
103
|
-
command: "view" | "create" | "str_replace" | "insert";
|
|
104
|
-
path: string;
|
|
105
|
-
file_text?: string;
|
|
106
|
-
insert_line?: number;
|
|
107
|
-
new_str?: string;
|
|
108
|
-
insert_text?: string;
|
|
109
|
-
old_str?: string;
|
|
110
|
-
view_range?: number[];
|
|
111
|
-
}, {
|
|
112
|
-
maxCharacters?: number;
|
|
113
|
-
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
114
|
-
command: "view" | "create" | "str_replace" | "insert";
|
|
115
|
-
path: string;
|
|
116
|
-
file_text?: string;
|
|
117
|
-
insert_line?: number;
|
|
118
|
-
new_str?: string;
|
|
119
|
-
insert_text?: string;
|
|
120
|
-
old_str?: string;
|
|
121
|
-
view_range?: number[];
|
|
122
|
-
}, unknown, {}>;
|
|
123
|
-
/**
|
|
124
|
-
* Claude can interact with computer environments through the computer use tool, which
|
|
125
|
-
* provides screenshot capabilities and mouse/keyboard control for autonomous desktop interaction.
|
|
126
|
-
*
|
|
127
|
-
* Image results are supported.
|
|
128
|
-
*/
|
|
129
|
-
computer_20241022: _ai_sdk_provider_utils.ProviderToolFactory<{
|
|
130
|
-
action: "key" | "type" | "mouse_move" | "left_click" | "left_click_drag" | "right_click" | "middle_click" | "double_click" | "screenshot" | "cursor_position";
|
|
131
|
-
coordinate?: number[];
|
|
132
|
-
text?: string;
|
|
133
|
-
}, {
|
|
134
|
-
displayWidthPx: number;
|
|
135
|
-
displayHeightPx: number;
|
|
136
|
-
displayNumber?: number;
|
|
137
|
-
}, {}>;
|
|
138
|
-
/**
|
|
139
|
-
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
140
|
-
*/
|
|
141
|
-
webSearch_20250305: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
142
|
-
query: string;
|
|
143
|
-
}, {
|
|
144
|
-
type: "web_search_result";
|
|
145
|
-
url: string;
|
|
146
|
-
title: string | null;
|
|
147
|
-
pageAge: string | null;
|
|
148
|
-
encryptedContent: string;
|
|
149
|
-
}[], {
|
|
150
|
-
maxUses?: number;
|
|
151
|
-
allowedDomains?: string[];
|
|
152
|
-
blockedDomains?: string[];
|
|
153
|
-
userLocation?: {
|
|
154
|
-
type: "approximate";
|
|
155
|
-
city?: string;
|
|
156
|
-
region?: string;
|
|
157
|
-
country?: string;
|
|
158
|
-
timezone?: string;
|
|
159
|
-
};
|
|
160
|
-
}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
161
|
-
query: string;
|
|
162
|
-
}, {
|
|
163
|
-
type: "web_search_result";
|
|
164
|
-
url: string;
|
|
165
|
-
title: string | null;
|
|
166
|
-
pageAge: string | null;
|
|
167
|
-
encryptedContent: string;
|
|
168
|
-
}[], {}>;
|
|
169
|
-
/**
|
|
170
|
-
* Creates a tool search tool that uses regex patterns to find tools.
|
|
171
|
-
*
|
|
172
|
-
* The tool search tool enables Claude to work with hundreds or thousands of tools
|
|
173
|
-
* by dynamically discovering and loading them on-demand.
|
|
174
|
-
*
|
|
175
|
-
* Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
|
|
176
|
-
* to mark them for deferred loading.
|
|
177
|
-
*/
|
|
178
|
-
toolSearchRegex_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
179
|
-
pattern: string;
|
|
180
|
-
limit?: number;
|
|
181
|
-
}, {
|
|
182
|
-
type: "tool_reference";
|
|
183
|
-
toolName: string;
|
|
184
|
-
}[], {}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
185
|
-
pattern: string;
|
|
186
|
-
limit?: number;
|
|
187
|
-
}, {
|
|
188
|
-
type: "tool_reference";
|
|
189
|
-
toolName: string;
|
|
190
|
-
}[], {}>;
|
|
191
|
-
/**
|
|
192
|
-
* Creates a tool search tool that uses BM25 (natural language) to find tools.
|
|
193
|
-
*
|
|
194
|
-
* The tool search tool enables Claude to work with hundreds or thousands of tools
|
|
195
|
-
* by dynamically discovering and loading them on-demand.
|
|
196
|
-
*
|
|
197
|
-
* Use `providerOptions: { anthropic: { deferLoading: true } }` on other tools
|
|
198
|
-
* to mark them for deferred loading.
|
|
199
|
-
*/
|
|
200
|
-
toolSearchBm25_20251119: (args?: Parameters<_ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
201
|
-
query: string;
|
|
202
|
-
limit?: number;
|
|
203
|
-
}, {
|
|
204
|
-
type: "tool_reference";
|
|
205
|
-
toolName: string;
|
|
206
|
-
}[], {}, {}>>[0]) => _ai_sdk_provider_utils.Tool<{
|
|
207
|
-
query: string;
|
|
208
|
-
limit?: number;
|
|
209
|
-
}, {
|
|
210
|
-
type: "tool_reference";
|
|
211
|
-
toolName: string;
|
|
212
|
-
}[], {}>;
|
|
213
|
-
};
|
|
214
|
-
interface GoogleVertexAnthropicProvider extends ProviderV4 {
|
|
215
|
-
/**
|
|
216
|
-
* Creates a model for text generation.
|
|
217
|
-
*/
|
|
218
|
-
(modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV4;
|
|
219
|
-
/**
|
|
220
|
-
* Creates a model for text generation.
|
|
221
|
-
*/
|
|
222
|
-
languageModel(modelId: GoogleVertexAnthropicMessagesModelId): LanguageModelV4;
|
|
223
|
-
/**
|
|
224
|
-
* Anthropic tools supported by Google Vertex.
|
|
225
|
-
* Note: Only a subset of Anthropic tools are available on Vertex.
|
|
226
|
-
* Supported tools: bash_20241022, bash_20250124, textEditor_20241022,
|
|
227
|
-
* textEditor_20250124, textEditor_20250429, textEditor_20250728,
|
|
228
|
-
* computer_20241022, webSearch_20250305, toolSearchRegex_20251119,
|
|
229
|
-
* toolSearchBm25_20251119
|
|
230
|
-
*/
|
|
231
|
-
tools: typeof vertexAnthropicTools;
|
|
232
|
-
/**
|
|
233
|
-
* @deprecated Use `embeddingModel` instead.
|
|
234
|
-
*/
|
|
235
|
-
textEmbeddingModel(modelId: string): never;
|
|
236
|
-
}
|
|
237
|
-
interface GoogleVertexAnthropicProviderSettings$1 {
|
|
238
|
-
/**
|
|
239
|
-
* Google Cloud project ID. Defaults to the value of the `GOOGLE_VERTEX_PROJECT` environment variable.
|
|
240
|
-
*/
|
|
241
|
-
project?: string;
|
|
242
|
-
/**
|
|
243
|
-
* Google Cloud region. Defaults to the value of the `GOOGLE_VERTEX_LOCATION` environment variable.
|
|
244
|
-
*/
|
|
245
|
-
location?: string;
|
|
246
|
-
/**
|
|
247
|
-
* Use a different URL prefix for API calls, e.g. to use proxy servers.
|
|
248
|
-
* The default prefix is `https://api.anthropic.com/v1`.
|
|
249
|
-
*/
|
|
250
|
-
baseURL?: string;
|
|
251
|
-
/**
|
|
252
|
-
* Custom headers to include in the requests.
|
|
253
|
-
*/
|
|
254
|
-
headers?: Resolvable<Record<string, string | undefined>>;
|
|
255
|
-
/**
|
|
256
|
-
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
257
|
-
* or to provide a custom fetch implementation for e.g. testing.
|
|
258
|
-
*/
|
|
259
|
-
fetch?: FetchFunction;
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
interface GoogleVertexAnthropicProviderSettings extends GoogleVertexAnthropicProviderSettings$1 {
|
|
263
|
-
/**
|
|
264
|
-
* Optional. The Google credentials for the Google Cloud service account. If
|
|
265
|
-
* not provided, the Google Vertex provider will use environment variables to
|
|
266
|
-
* load the credentials.
|
|
267
|
-
*/
|
|
268
|
-
googleCredentials?: GoogleCredentials;
|
|
269
|
-
}
|
|
270
|
-
declare function createVertexAnthropic(options?: GoogleVertexAnthropicProviderSettings): GoogleVertexAnthropicProvider;
|
|
271
|
-
/**
|
|
272
|
-
* Default Google Vertex AI Anthropic provider instance.
|
|
273
|
-
*/
|
|
274
|
-
declare const vertexAnthropic: GoogleVertexAnthropicProvider;
|
|
275
|
-
|
|
276
|
-
export { type GoogleVertexAnthropicProvider, type GoogleVertexAnthropicProviderSettings, createVertexAnthropic, vertexAnthropic };
|