Documentation
¶
Overview ¶
Package vertex provides an Anthropic client for Claude models hosted on Google Cloud's Vertex AI. It lives in its own package so that importing the core anthropic provider does not pull the Google Cloud auth stack (cloud.google.com/go/auth, google.golang.org/api, grpc, ...).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(ctx context.Context, cfg *latest.ModelConfig, env environment.Provider, project, location string, opts ...options.Opt) (*anthropic.Client, error)
NewClient creates a new Anthropic client that talks to Claude models hosted on Google Cloud's Vertex AI via the Anthropic-native endpoints (`:rawPredict` and `:streamRawPredict`), authenticated with Google Application Default Credentials.
This is required because Anthropic models on Vertex AI do not support the OpenAI-compatible `/chat/completions` endpoint and fail with `FAILED_PRECONDITION: The deployed model does not support ChatCompletions.`
func NewClientWithTokenSource ¶ added in v1.142.0
func NewClientWithTokenSource(ctx context.Context, cfg *latest.ModelConfig, env environment.Provider, project, location string, source options.TokenSource, opts ...options.Opt) (*anthropic.Client, error)
NewClientWithTokenSource is NewClient authenticated with source instead of Application Default Credentials, which are never looked up. The token is resolved with each request's context, so per-request values such as the session ID and cancellation reach the source.
Types ¶
This section is empty.