GoogleVertexAnthropicProvider
Namespace: Vercel.AI.Google
public sealed class GoogleVertexAnthropicProvider : AnthropicProvider, IBatchProvider, IDecisionProvider, IEvaluationProviderAnthropic on Vertex. Sends the Anthropic Messages body to rawPredict with anthropic_version in the body.
Vertex does not accept URL sources, the native output format, or strict tools.
Inheritance: object → ProviderBase → AnthropicProvider
Implements: IBatchProvider, IDecisionProvider, IEvaluationProvider
Constructors
Section titled “Constructors”GoogleVertexAnthropicProvider(HttpClient, GoogleVertexAnthropicOptions?)
Section titled “GoogleVertexAnthropicProvider(HttpClient, GoogleVertexAnthropicOptions?)”public GoogleVertexAnthropicProvider(HttpClient httpClient, GoogleVertexAnthropicOptions? options = null)Creates a provider.
Parameters
| Name | Type | Description |
|---|---|---|
httpClient |
HttpClient | |
options |
GoogleVertexAnthropicOptions |
Fields
Section titled “Fields”ModelProviderName
Section titled “ModelProviderName”public const string ModelProviderName = "googleVertex.anthropic.messages"Provider id reported by language models.
Value: string
Properties
Section titled “Properties”BaseUrl
Section titled “BaseUrl”public string BaseUrl { get; }Publisher base URL.
Value: string
Location
Section titled “Location”public string? Location { get; }Location.
Value: string
Project
Section titled “Project”public string? Project { get; }Project id.
Value: string
SupportedUrls
Section titled “SupportedUrls”protected override IReadOnlyDictionary<string, string> SupportedUrls { get; }URL patterns that models of this provider accept for images and PDFs.
Value: IReadOnlyDictionary<string, string>
SupportsNativeStructuredOutput
Section titled “SupportsNativeStructuredOutput”protected override bool SupportsNativeStructuredOutput { get; }False when the host does not accept the native output format. Structured output then uses the JSON tool.
Value: bool
SupportsStrictTools
Section titled “SupportsStrictTools”protected override bool SupportsStrictTools { get; }False when the host does not accept strict on tool definitions.
Value: bool
public static IReadOnlyList<string> Tools { get; }Provider tool ids that Vertex accepts. A subset of the Anthropic tools.
Value: IReadOnlyList<string>
Methods
Section titled “Methods”Create(GoogleVertexAnthropicOptions?, HttpMessageHandler?)
Section titled “Create(GoogleVertexAnthropicOptions?, HttpMessageHandler?)”public static GoogleVertexAnthropicProvider Create(GoogleVertexAnthropicOptions? options = null, HttpMessageHandler? handler = null)Creates a provider. Pass a handler from tests.
Parameters
| Name | Type | Description |
|---|---|---|
options |
GoogleVertexAnthropicOptions | |
handler |
HttpMessageHandler |
Returns: GoogleVertexAnthropicProvider
CreateHeadersAsync(IReadOnlyList<string>, IReadOnlyDictionary<string, string?>?, string?, CancellationToken)
Section titled “CreateHeadersAsync(IReadOnlyList<string>, IReadOnlyDictionary<string, string?>?, string?, CancellationToken)”public override Task<Dictionary<string, string?>> CreateHeadersAsync(IReadOnlyList<string> betas, IReadOnlyDictionary<string, string?>? callHeaders, string? body, CancellationToken cancellationToken)Generated bearer token, then configured headers, call headers, and beta flags.
Parameters
| Name | Type | Description |
|---|---|---|
betas |
IReadOnlyList<string> | |
callHeaders |
IReadOnlyDictionary<string, string> | |
body |
string | |
cancellationToken |
CancellationToken |
Returns: Task<Dictionary<string, string>>
EmbeddingModel(string)
Section titled “EmbeddingModel(string)”public override IEmbeddingModel EmbeddingModel(string modelId)Embedding models are not available on this provider.
Parameters
| Name | Type | Description |
|---|---|---|
modelId |
string |
Returns: IEmbeddingModel
PredictUrl(string, bool)
Section titled “PredictUrl(string, bool)”public string PredictUrl(string modelId, bool streaming)rawPredict or streamRawPredict URL for a model.
Parameters
| Name | Type | Description |
|---|---|---|
modelId |
string | |
streaming |
bool |
Returns: string
RequestUri(string, bool)
Section titled “RequestUri(string, bool)”protected override Uri RequestUri(string modelId, bool streaming)URL for one model call. Defaults to MessagesUri().
Parameters
| Name | Type | Description |
|---|---|---|
modelId |
string | |
streaming |
bool |
Returns: Uri
TransformBody(JsonObject)
Section titled “TransformBody(JsonObject)”public static JsonObject TransformBody(JsonObject body)Removes model and sets anthropic_version.
Parameters
| Name | Type | Description |
|---|---|---|
body |
JsonObject |
Returns: JsonObject
TransformHeaders(Dictionary<string, string?>, IReadOnlyDictionary<string, JsonElement>?)
Section titled “TransformHeaders(Dictionary<string, string?>, IReadOnlyDictionary<string, JsonElement>?)”public static Dictionary<string, string?> TransformHeaders(Dictionary<string, string?> headers, IReadOnlyDictionary<string, JsonElement>? providerOptions)Sends providerOptions.vertex.labels as the x-vertex-ai-labels header. An explicit header wins.
Parameters
| Name | Type | Description |
|---|---|---|
headers |
Dictionary<string, string> | |
providerOptions |
IReadOnlyDictionary<string, JsonElement> |
Returns: Dictionary<string, string>
Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product