google / generative-ai-go

Go SDK for Google Generative AI
Apache License 2.0
559 stars 57 forks source link

Document relationship with cloud SDK genai client #219

Open anuraaga opened 17 hours ago

anuraaga commented 17 hours ago

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

eliben commented 12 hours ago

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 commented 9 hours ago

To elaborate on some of your observations: