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 ¶
- func BearerToken(ctx context.Context) (string, error)
- func BearerTokenWithCreds(ctx context.Context, credJSON string) (string, error)
- func NewTokenSource(ctx context.Context, credJSON string) (oauth2.TokenSource, error)
- func NewVertexProvider(publisher, modelName string, baseURLs []string, cap modelrepo.CapabilityConfig, ...) modelrepo.Provider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BearerToken ¶
BearerToken returns a fresh ADC access token for Vertex AI.
func BearerTokenWithCreds ¶
BearerTokenWithCreds returns an access token using the provided service account JSON when non-empty, or ADC when empty.
func NewTokenSource ¶
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.