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

Document relationship with cloud SDK genai client #219

Open
anuraaga opened this issue Oct 9, 2024 · 3 comments
Open

Document relationship with cloud SDK genai client #219

anuraaga opened this issue Oct 9, 2024 · 3 comments
Labels
component:documentation Improvements or additions to documentation type:feature request New feature request or enhancement

Comments

@anuraaga
Copy link

anuraaga commented Oct 9, 2024

Description of the feature request:

I found this library when searching for connecting to Gemini from Go. I was familiar with cloud.google.com/go/vertexai/genai and hadn't seen this yet, without thinking too much I thought perhaps it's a more idiomatic entry point to genai than the cloud SDK which are often close to auto-generated stubs (though I'm not sure this is the case for vertexai/genai specifically). But when trying to use the client with application default credentials like normal, using option.WithTokenSource, I couldn't get it to authenticate, even when trying scopes like https://www.googleapis.com/auth/generative-language. Eventually, I switched to vertexai/genai and had no problem. To my surprise, this was almost just replacing import statements, and one tweak to client initialization logic, which made me realize my hypothesis about the API being possibly more idiomatic wasn't correct.

I notice the docs for this project mention using an API key and don't mention application default credentials (yes I did try knowing the doc said "requires an API key" hoping it was a typo), other than that I'm not clear what the difference / use case for this project is. I guess my new hypothesis is it's meant to be for non-GCP users, while I've never thought to try it I guess "Google AI" is trying to be a purely AI product with decoupling from GCP. For GCP users, it's best to stick to the cloud SDK.

It would be nice to add documentation something like that, or otherwise whatever the case may be, to help prevent confusion for users that happen to find this while trying to use within GCP.

What problem are you trying to solve with this feature?

No response

Any other information you'd like to share?

No response

@anuraaga anuraaga added the type:feature request New feature request or enhancement label Oct 9, 2024
@eliben eliben added the component:documentation Improvements or additions to documentation label Oct 9, 2024
@eliben
Copy link
Member

eliben commented Oct 9, 2024

Thanks for the note. We're thinking about the topic of documentation more holistically now across the different SDKs and languages; I will keep this issue open for now

@jba
Copy link
Collaborator

jba commented Oct 9, 2024

To elaborate on some of your observations:

  • There are two APIs because there are two products: one requires minimal auth and no GCP account; the other is designed for enterprise GCP users with GCP projects, billing, and so on. That is why the auth is different. We worked hard to make the API surfaces as close as possible.

  • We also worked hard to make them idiomatic Go, and to raise the level over direct RPCs to the service. We use the generated API as a base, then wrap protobuffers, rename, and perform other changes and additions to provide what we hope is an idiomatic and pleasant coding experience. The chat API is an example of raising the level above the raw RPCs.

@anuraaga
Copy link
Author

Thanks @jba - I hadn't realized there's actually two APIs with similar surfaces, which is clarifying. BTW, I didn't mean to indicate the APIs aren't idiomatic, I found them easy enough to use, I was just surprised to see the match against the GCP SDK's client, which I'm used to not having such usability in other services ;)

I suspect just a line such as this at the top of the docs would help a lot. "Generative AI" is a general term so I think it's easy to expect this repo to apply to vertex AI as well and cause confusion.

This SDK is for the Google AI Studio. Google Cloud Platform Vertex AI users should use the [Google Cloud SDK](https://pkg.go.dev/cloud.google.com/go/vertexai/genai) instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:documentation Improvements or additions to documentation type:feature request New feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants