vertexai

package
v1.140.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

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 = contracts.Provider

Client is the canonical provider contract returned by NewClient. Both anthropic.Client and openai.Client satisfy it.

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

The underlying client is constructed with a Provider field rewritten so that downstream capability lookups against models.dev resolve correctly. Without this rewrite, attachments and other capability-gated features are silently dropped because `<provider>/<model>` IDs like `google/claude-sonnet-4-20250514` do not exist in the models.dev database. See modelsDevProvider for the exact mapping.

Jump to

Keyboard shortcuts

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