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

feat(vertex): add credentials argument #542

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

mitraan-deshaw
Copy link
Contributor

Currently, the AnthropicVertex class initializes its own default google.auth Credentials object. However, there are instances where we want to pass a Credentials object with custom service account information and scopes. For example:

import json
from anthropic import AnthropicVertex
from google.oauth2 import service_account

credentials = service_account.Credentials.from_service_account_info(
    json.loads(google_credentials), 
    scopes=['https://www.googleapis.com/auth/cloud-platform.read-only']
)

client = AnthropicVertex(
    project_id=project_id,
    credentials=credentials,
    region=region_name
)

This PR implements the same for AnthropicVertex and AsyncAnthropicVertex.

@mitraan-deshaw mitraan-deshaw requested a review from a team as a code owner June 17, 2024 20:38
Copy link
Collaborator

@RobertCraigie RobertCraigie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@RobertCraigie RobertCraigie changed the base branch from main to next June 26, 2024 18:09
@RobertCraigie RobertCraigie changed the title Add credentials argument to AnthropicVertex feat(vertex): add credentials argument Jun 26, 2024
@RobertCraigie RobertCraigie merged commit 3bfb2ea into anthropics:next Jun 26, 2024
4 checks passed
@stainless-app stainless-app bot mentioned this pull request Jun 26, 2024
stainless-app bot pushed a commit that referenced this pull request Jun 26, 2024
Co-authored-by: Anshuman Mitra <mitraan@deshaw.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants