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

genai: In NewClient() c.SetGoogleClientInfo undefined (type *aiplatform.PredictionClient has no field or method SetGoogleClientInfo) #9167

Closed
codecrane opened this issue Dec 13, 2023 · 2 comments · Fixed by #9168
Assignees
Labels
type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@codecrane
Copy link

codecrane commented Dec 13, 2023

Code:

https://github.com/googleapis/google-cloud-go/blame/77c1cfac704dab6704e9b55bdd8a710695dc936a/vertexai/genai/client.go#L56

func NewClient(ctx context.Context, projectID, location string, opts ...option.ClientOption) (*Client, error) {
	opts = append([]option.ClientOption{
		option.WithEndpoint(fmt.Sprintf("%s-aiplatform.googleapis.com:443", location)),
	}, opts...)
	c, err := aiplatform.NewPredictionClient(ctx, opts...)
	if err != nil {
		return nil, err
	}
	c.SetGoogleClientInfo("gccl", internal.Version)
	return &Client{
		c:         c,
		projectID: projectID,
		location:  location,
	}, nil
}

Implication:
Application does not compile as SetGoogleClientInfo() is not available in the pinned version of the Prediction client. It looks like NewClient() is attempting to call the prediction client internal c.setGoogleClientInfo()
https://github.com/googleapis/google-cloud-go/blob/main/aiplatform/apiv1beta1/prediction_client.go#L412

# cloud.google.com/go/vertexai/genai
../../go/pkg/mod/cloud.google.com/go/vertexai@v0.5.1/genai/client.go:56:4: c.SetGoogleClientInfo undefined (type *aiplatform.PredictionClient has no field or method SetGoogleClientInfo)

Solution:
Remove the call to c.SetGoogleClientInfo("gccl", internal.Version) from func NewClient(ctx context.Context, projectID, location string, opts ...option.ClientOption) (*Client, error) {

@codyoss codyoss added the type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. label Dec 14, 2023
@codyoss codyoss self-assigned this Dec 14, 2023
@codyoss
Copy link
Member

codyoss commented Dec 14, 2023

Will get a patch out but as a workaround you can pull cloud.google.com/go/aiplatform@v1.58.0, sorry about that

@codyoss
Copy link
Member

codyoss commented Dec 14, 2023

Thank you for the report! Released in 0.5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@codyoss @codecrane and others