Documentation
¶
Overview ¶
Package vertexai provides support for non-Gemini models hosted on Google Cloud's Vertex AI Model Garden.
Vertex AI Model Garden hosts models from various publishers (Anthropic, Meta, Mistral, etc.) and exposes them through two different APIs:
- Anthropic Claude models: the Anthropic-native `:rawPredict` / `:streamRawPredict` endpoints. Claude models do not support the OpenAI-compatible path.
- Other publishers: Vertex AI's OpenAI-compatible `/chat/completions` endpoint.
Authentication uses Google Cloud Application Default Credentials.
Usage in agent config:
models:
claude-on-vertex:
provider: google
model: claude-sonnet-4-20250514
provider_opts:
project: my-gcp-project
location: us-east5
publisher: anthropic
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsModelGardenConfig ¶
func IsModelGardenConfig(cfg *latest.ModelConfig) bool
IsModelGardenConfig returns true when the ModelConfig describes a non-Gemini model on Vertex AI (i.e. the "publisher" provider_opt is set to something other than "google").
Types ¶
type Client ¶ added in v1.51.0
type Client interface {
ID() string
CreateChatCompletionStream(ctx context.Context, messages []chat.Message, tools []tools.Tool) (chat.MessageStream, error)
BaseConfig() base.Config
}
Client is the subset of provider.Provider returned by NewClient. Both anthropic.Client and openai.Client satisfy it, so the caller can treat the two Model Garden code paths uniformly.
func NewClient ¶
func NewClient(ctx context.Context, cfg *latest.ModelConfig, env environment.Provider, opts ...options.Opt) (Client, error)
NewClient creates a client for a non-Gemini model on Vertex AI Model Garden, choosing the right endpoint based on the publisher:
- publisher: anthropic → Anthropic-native `:streamRawPredict` endpoint.
- other publishers → Vertex AI's OpenAI-compatible `/chat/completions`.