@ai-sdk/google-vertex
Version:
246 lines • 10 kB
TypeScript
import { FetchFunction, Resolvable } from "@ai-sdk/provider-utils";
import { GoogleAuthOptions } from "google-auth-library";
import { LanguageModelV4, ProviderV4 } from "@ai-sdk/provider";
import { anthropicTools } from "@ai-sdk/anthropic/internal";
//#region src/google-vertex-model-catalog.d.ts
declare const languageModelIds: readonly ["gemini-nano-banana-2.1", "gemini-4-argon", "gemini-4-carbon", "gemini-4-hydrogen", "gemini-3.8-flash", "gemini-3.7-flash", "gemini-3.6-flash", "gemini-3.5-flash", "gemini-3.5-flash-lite", "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-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"];
declare const imageModelIds: readonly ["gemini-2.5-flash-image", "gemini-3-pro-image-preview", "gemini-3.1-flash-image-preview", "gemini-nano-banana-2.1"];
declare const embeddingModelIds: readonly ["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", "gemini-embedding-2-preview"];
declare const videoModelIds: readonly ["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"];
declare const speechModelIds: readonly ["gemini-2.5-flash-tts", "gemini-2.5-pro-tts", "gemini-2.5-flash-lite-preview-tts", "gemini-3.1-flash-tts-preview", "chirp-3-hd"];
declare const transcriptionModelIds: readonly ["chirp_2", "chirp_3", "telephony"];
declare const geminiTranscriptionModelIds: readonly ["gemini-3.5-transcribe", "gemini-3.5-transcribe-live"];
declare const vertexAnthropicModels: {
'claude-fable-5-1': {
image: boolean;
objectGeneration: boolean;
tools: boolean;
streaming: boolean;
computerUse: boolean;
};
'claude-fable-5-2': {
image: boolean;
objectGeneration: boolean;
tools: boolean;
streaming: boolean;
computerUse: boolean;
};
'claude-3-7-sonnet@20250219': {
image: boolean;
objectGeneration: boolean;
tools: boolean;
streaming: boolean;
computerUse: boolean;
};
'claude-3-5-sonnet-v2@20241022': {
image: boolean;
objectGeneration: boolean;
tools: boolean;
streaming: boolean;
computerUse: boolean;
};
'claude-3-5-sonnet@20240620': {
image: boolean;
objectGeneration: boolean;
tools: boolean;
streaming: boolean;
computerUse: boolean;
};
'claude-3-5-haiku@20241022': {
image: boolean;
objectGeneration: boolean;
tools: boolean;
streaming: boolean;
computerUse: boolean;
};
'claude-3-sonnet@20240229': {
image: boolean;
objectGeneration: boolean;
tools: boolean;
streaming: boolean;
computerUse: boolean;
};
'claude-3-haiku@20240307': {
image: boolean;
objectGeneration: boolean;
tools: boolean;
streaming: boolean;
computerUse: boolean;
};
'claude-3-opus@20240229': {
image: boolean;
objectGeneration: boolean;
tools: boolean;
streaming: boolean;
computerUse: boolean;
};
'claude-fable-5': undefined;
'claude-haiku-5-5': undefined;
'claude-opus-4-1@20250805': undefined;
'claude-opus-4-5@20251101': undefined;
'claude-opus-4-6': undefined;
'claude-opus-4-7': undefined;
'claude-opus-4-8': undefined;
'claude-opus-4@20250514': undefined;
'claude-opus-5': undefined;
'claude-opus-5-5': undefined;
'claude-sonnet-4-5@20250929': undefined;
'claude-sonnet-4-6': undefined;
'claude-sonnet-4@20250514': undefined;
'claude-sonnet-5': undefined;
'claude-sonnet-5-5': undefined;
};
declare const vertexXaiModels: {
'xai/grok-4.20-reasoning': {
reasoning: boolean;
};
'xai/grok-4.20-non-reasoning': {
reasoning: boolean;
};
'xai/grok-4.1-fast-reasoning': {
reasoning: boolean;
};
'xai/grok-4.1-fast-non-reasoning': {
reasoning: boolean;
};
};
declare const vertexMaasModels: {
'deepseek-ai/deepseek-r1-0528-maas': {
publisher: string;
};
'deepseek-ai/deepseek-v3.1-maas': {
publisher: string;
};
'deepseek-ai/deepseek-v3.2-maas': {
publisher: string;
};
'openai/gpt-oss-120b-maas': {
publisher: string;
};
'openai/gpt-oss-20b-maas': {
publisher: string;
};
'meta/llama-4-maverick-17b-128e-instruct-maas': {
publisher: string;
};
'meta/llama-4-scout-17b-16e-instruct-maas': {
publisher: string;
};
'minimax/minimax-m2-maas': {
publisher: string;
};
'qwen/qwen3-coder-480b-a35b-instruct-maas': {
publisher: string;
};
'qwen/qwen3-next-80b-a3b-instruct-maas': {
publisher: string;
};
'qwen/qwen3-next-80b-a3b-thinking-maas': {
publisher: string;
};
'moonshotai/kimi-k2-thinking-maas': {
publisher: string;
};
};
/** Known model IDs, derived from the declarations used to build the catalog. */
type GoogleVertexModelIds = {
language: (typeof languageModelIds)[number];
image: (typeof imageModelIds)[number];
embedding: (typeof embeddingModelIds)[number];
video: (typeof videoModelIds)[number];
speech: (typeof speechModelIds)[number];
transcription: (typeof transcriptionModelIds)[number];
geminiTranscription: (typeof geminiTranscriptionModelIds)[number];
anthropic: keyof typeof vertexAnthropicModels;
xai: keyof typeof vertexXaiModels;
maas: keyof typeof vertexMaasModels;
};
//#endregion
//#region src/anthropic/google-vertex-anthropic-options.d.ts
type GoogleVertexAnthropicModelId = GoogleVertexModelIds['anthropic'] | (string & {});
//#endregion
//#region src/anthropic/google-vertex-anthropic-provider.d.ts
type GoogleVertexAnthropicTools = Pick<typeof anthropicTools, 'bash_20241022' | 'bash_20250124' | 'textEditor_20241022' | 'textEditor_20250124' | 'textEditor_20250429' | 'textEditor_20250728' | 'computer_20241022' | 'webSearch_20250305' | 'toolSearchRegex_20251119' | 'toolSearchBm25_20251119'>;
/**
* Tools supported by Google Vertex Anthropic.
* This is a subset of the full Anthropic tools - only these are recognized by the Vertex API.
*/
declare const googleVertexAnthropicTools: GoogleVertexAnthropicTools;
interface GoogleVertexAnthropicProvider extends ProviderV4 {
/**
* Creates a model for text generation.
*/
(modelId: GoogleVertexAnthropicModelId): LanguageModelV4;
/**
* Creates a model for text generation.
*/
languageModel(modelId: GoogleVertexAnthropicModelId): LanguageModelV4;
/**
* Anthropic tools supported by Google Vertex.
* Note: Only a subset of Anthropic tools are available on Vertex.
* Supported tools: bash_20241022, bash_20250124, textEditor_20241022,
* textEditor_20250124, textEditor_20250429, textEditor_20250728,
* computer_20241022, webSearch_20250305, toolSearchRegex_20251119,
* toolSearchBm25_20251119
*/
tools: typeof googleVertexAnthropicTools;
/**
* @deprecated Use `embeddingModel` instead.
*/
textEmbeddingModel(modelId: string): never;
}
interface GoogleVertexAnthropicProviderSettings$1 {
/**
* Google Cloud project ID. Defaults to the value of the `GOOGLE_VERTEX_PROJECT` environment variable.
*/
project?: string;
/**
* Google Cloud region. Defaults to the value of the `GOOGLE_VERTEX_LOCATION` environment variable.
*/
location?: string;
/**
* Enable native structured output in `structuredOutputMode: 'auto'` for Claude
* 4.5 and newer. Defaults to false. Requires the Google Cloud organization
* policy to allow the `structured_outputs` feature for each model used.
* This does not enable strict tool input schemas.
*/
supportsNativeStructuredOutput?: boolean;
/**
* Use a different URL prefix for API calls, e.g. to use proxy servers.
* The default prefix is `https://api.anthropic.com/v1`.
*/
baseURL?: string;
/**
* Custom headers to include in the requests.
*/
headers?: Resolvable<Record<string, string | undefined>>;
/**
* Custom fetch implementation. You can use it as a middleware to intercept requests,
* or to provide a custom fetch implementation for e.g. testing.
*/
fetch?: FetchFunction;
}
//#endregion
//#region src/anthropic/google-vertex-anthropic-provider-node.d.ts
interface GoogleVertexAnthropicProviderSettings extends GoogleVertexAnthropicProviderSettings$1 {
/**
* Optional. The Authentication options provided by google-auth-library.
* Complete list of authentication options is documented in the
* GoogleAuthOptions interface:
* https://github.com/googleapis/google-auth-library-nodejs/blob/main/src/auth/googleauth.ts.
*/
googleAuthOptions?: GoogleAuthOptions;
/**
* Optional. Override the Bearer token generator. Defaults to OAuth exchange
* via `google-auth-library` with `googleAuthOptions`.
*/
generateAuthToken?: () => Promise<string | null>;
}
export declare function createGoogleVertexAnthropic(options?: GoogleVertexAnthropicProviderSettings): GoogleVertexAnthropicProvider;
/**
* Default Google Vertex Anthropic provider instance.
*/
export declare const googleVertexAnthropic: GoogleVertexAnthropicProvider;
//#endregion
export { type GoogleVertexAnthropicProvider, type GoogleVertexAnthropicProviderSettings, createGoogleVertexAnthropic as createVertexAnthropic, googleVertexAnthropic as vertexAnthropic };
//# sourceMappingURL=index.d.ts.map