Merge pull request #3203 from BerriAI/revert-3150-anthropic-vertex-adc

Revert "Load google ADC before init AnthropicVertex"
This commit is contained in:
Ishaan Jaff 2024-04-21 16:45:31 -07:00 committed by GitHub
commit 87a08ec8b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -123,7 +123,7 @@ class VertexAIAnthropicConfig:
"""
- Run client init
- Run client init
- Support async completion, streaming
"""
@ -236,19 +236,17 @@ def completion(
if client is None:
if vertex_credentials is not None and isinstance(vertex_credentials, str):
import google.oauth2.service_account
json_obj = json.loads(vertex_credentials)
creds = (
google.oauth2.service_account.Credentials.from_service_account_info(
json.loads(vertex_credentials),
json_obj,
scopes=["https://www.googleapis.com/auth/cloud-platform"],
)
)
### CHECK IF ACCESS
access_token = refresh_auth(credentials=creds)
else:
import google.auth
creds, _ = google.auth.default()
### CHECK IF ACCESS
access_token = refresh_auth(credentials=creds)
vertex_ai_client = AnthropicVertex(
project_id=vertex_project,