Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions vertex/vertex.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,12 @@ func WithGoogleAuth(ctx context.Context, region string, projectID string, scopes

// WithCredentials returns a request option which uses the provided credentials for Google Vertex AI and registers middleware that
// intercepts request to the Messages API.
func WithCredentials(ctx context.Context, region string, projectID string, creds *google.Credentials) sdkoption.RequestOption {
client, _, err := transport.NewHTTPClient(ctx, option.WithTokenSource(creds.TokenSource))
func WithCredentials(ctx context.Context, region string, projectID string, creds *google.Credentials, clientOpts ...option.ClientOption) sdkoption.RequestOption {

opts := []option.ClientOption{option.WithTokenSource(creds.TokenSource)}
opts = append(opts, clientOpts...)

client, _, err := transport.NewHTTPClient(ctx, opts...)
if err != nil {
panic(fmt.Errorf("failed to create HTTP client: %v", err))
}
Expand Down