Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for multiple auth options (#105)
`hasApiKey` checks whether an API or `HTTPClient` is provided, however the check fails when using other auth options. For example: `client, err := genai.NewClient(ctx, option.WithTokenSource(ts))` Results in the following error: ``` You need an API key to use this client. Visit https://ai.google.dev to get one, put it in an environment variable like GEMINI_API_KEY, then pass it as an option: genai.NewClient(ctx, option.WithAPIKey(os.Getenv("GEMINI_API_KEY"))) (If you're doing that already, then maybe the environment variable is empty or unset.) Import the option package as "google.golang.org/api/option". ``` This PR adds support for additional authentication options to address this limitation. fixes: #103 --- Please let me know if you have any suggestions or require further changes :)
- Loading branch information