vertex

package
v1.164.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 16 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.`

See: https://docs.anthropic.com/en/api/claude-on-vertex-ai

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL