Documentation
¶
Overview ¶
Package vertex configures the standard OpenAI client for Google Vertex AI.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(ctx context.Context, cfg Config, userOpts ...option.RequestOption) (openai.Client, error)
NewClient creates a normal OpenAI client using Google Application Default Credentials unless Credentials or TokenProvider is supplied. Google token refresh and quota lookup receive the request context and its timeout.
Types ¶
type Config ¶
type Config struct {
// ProjectID defaults to GOOGLE_CLOUD_PROJECT when BaseURL is not supplied.
ProjectID string
// Location defaults to GOOGLE_CLOUD_LOCATION when BaseURL is not supplied.
Location string
// BaseURL overrides the provider base URL.
BaseURL string
// TokenProvider overrides ADC, e.g. to use credentials managed by the application.
TokenProvider TokenProvider
// Credentials supplies native Google credentials, including their refresh
// and quota project behavior. Mutually exclusive with TokenProvider.
Credentials *auth.Credentials
}
Config selects a Vertex project and location. BaseURL, if supplied, is the complete provider base URL up to the final /v1 (before /responses). Only this explicitly trusted origin can receive credentials. The OpenAI environment is ignored.
Click to show internal directories.
Click to hide internal directories.