tmc / langchaingo

LangChain for Go, the easiest way to write LLM-based programs in Go
https://tmc.github.io/langchaingo/
MIT License
3.83k stars 536 forks source link

Google AI Vertex set api key #615

Closed nilpntr closed 4 months ago

nilpntr commented 5 months ago

Got this error: google: could not find default credentials. See https://cloud.google.com/docs/authentication/external/set-up-adc for more information because I'm not able to set any authentication related options. There are only four options available, none of which have to do with authentication: WithCloudProject, WithCloudLocation, WithDefaultModel, and WithDefaultEmbeddingModel. What more should I provide in my Vertex authentication?

eliben commented 4 months ago

Follow this example: https://github.com/tmc/langchaingo/blob/main/examples/vertex-completion-example/vertex-completion-example.go

You should still set up ADC per the link that was printed, but the WithCloudProject option is indeed your authn

nilpntr commented 4 months ago

Thanks made it work!