vertex

package
v0.28.13 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package vertex implements the modelrepo.Provider contract against Google Vertex AI publisher endpoints, using OAuth bearer tokens minted from service-account credentials. The package registers its catalog at init time; depend on it via blank import where the catalog must be discoverable from runtimestate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BearerToken

func BearerToken(ctx context.Context) (string, error)

BearerToken returns a fresh ADC access token for Vertex AI.

func BearerTokenWithCreds

func BearerTokenWithCreds(ctx context.Context, credJSON string) (string, error)

BearerTokenWithCreds returns an access token using the provided service account JSON when non-empty, or ADC when empty.

func NewTokenSource

func NewTokenSource(ctx context.Context, credJSON string) (oauth2.TokenSource, error)

NewTokenSource returns a caching oauth2.TokenSource. Call this ONCE per provider and reuse the returned source — it caches the access token until expiry and only round-trips to the token endpoint on refresh. Creating a new source per request (as the BearerToken* helpers do) round-trips every time and adds ~100–400ms of auth latency to every chat/stream call.

credJSON is the service account key JSON; empty falls back to ADC.

func NewVertexProvider

func NewVertexProvider(publisher, modelName string, baseURLs []string, cap modelrepo.CapabilityConfig, credJSON string, httpClient *http.Client, tracker libtracker.ActivityTracker) modelrepo.Provider

NewVertexProvider returns a modelrepo.Provider for a Vertex AI model. credJSON is the service account key JSON; empty string falls back to ADC.

Types

This section is empty.

Jump to

Keyboard shortcuts

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