From b88a21b0945c0f3ac05ed8ba6705e675d8504f2d Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Sun, 21 Apr 2024 16:44:23 -0700 Subject: [PATCH] Revert "Load google ADC before init AnthropicVertex" --- litellm/llms/vertex_ai_anthropic.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/litellm/llms/vertex_ai_anthropic.py b/litellm/llms/vertex_ai_anthropic.py index 34709e0c56..9bce746dd6 100644 --- a/litellm/llms/vertex_ai_anthropic.py +++ b/litellm/llms/vertex_ai_anthropic.py @@ -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,