Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(vertexai): use opts in NewClient #9165

Closed
wants to merge 1 commit into from
Closed

Conversation

eliben
Copy link
Contributor

@eliben eliben commented Dec 13, 2023

Fixes #9160

@eliben eliben requested review from a team as code owners December 13, 2023 21:18
@product-auto-label product-auto-label bot added the size: xs Pull request size is extra small. label Dec 13, 2023
@eliben eliben requested a review from jba December 13, 2023 21:19
@eliben eliben added the automerge Merge the pull request once unit tests and other checks pass. label Dec 13, 2023
@eliben eliben closed this Dec 13, 2023
@gcf-merge-on-green gcf-merge-on-green bot removed the automerge Merge the pull request once unit tests and other checks pass. label Dec 13, 2023
@eliben
Copy link
Contributor Author

eliben commented Dec 13, 2023

Closing in favor of #9163 that was earlier

@jba
Copy link
Contributor

jba commented Dec 13, 2023

Thanks for doing this, sorry I missed it.

You can test by passing in your own endpoint option that's wrong, and looking for an error.

@@ -47,7 +47,8 @@ type Client struct {
// package.
func NewClient(ctx context.Context, projectID, location string, opts ...option.ClientOption) (*Client, error) {
apiEndpoint := fmt.Sprintf("%s-aiplatform.googleapis.com:443", location)
c, err := aiplatform.NewPredictionClient(ctx, option.WithEndpoint(apiEndpoint))
opts = append(opts, option.WithEndpoint(apiEndpoint))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Appending to opts could affect the caller.
Also we want the user opts to override whatever we do.
Follow this pattern: https://github.com/googleapis/google-cloud-go/blob/main/bigquery/storage_client.go#L59.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! can you add these comments on #9163 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary, #9163 is correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: xs Pull request size is extra small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

genai: func NewClient does not use opts ...option.ClientOption param
2 participants