fix(anthropic): anthropic with vertex works with service account json keys#157
Open
Cali0707 wants to merge 1 commit intocharmbracelet:mainfrom
Open
fix(anthropic): anthropic with vertex works with service account json keys#157Cali0707 wants to merge 1 commit intocharmbracelet:mainfrom
Cali0707 wants to merge 1 commit intocharmbracelet:mainfrom
Conversation
… keys Signed-off-by: Calum Murray <cmurray@redhat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CONTRIBUTING.md.I have created a discussion that was approved by a maintainer (for new features).Not needed, this is a bug fixThe bug
Currently, when using this package with an anthropic model from vertex, it fails when trying to use service account json keys for auth. This is a common auth setup for e.g. CI/CD pipelines, or where orgs restrict user based ADC/API key creation.
In particular, this is the error that I was seeing (redacted project/region details):
Proposed fix
This is not an issue when using the google provider with vertex directly, as that gets the credentials through the google genai package, which sets the scope itself: https://github.com/googleapis/go-genai/blob/37134ea8c0c17d262c26ed46e31ada75406dff02/client.go#L366
All I changed is also setting this scope when using the vertex option in the anthropic provider