Open vaghelarahul94 opened 1 month ago
google.auth.exceptions.MalformedError: Invalid Identity Pool credential_source field 'environment_id'
this error is coming from the google sdk not litellm
os.environ["GOOGLE_APPLICATION_CREDENTIALS"]="PATH_TO_JSON"
Try doing using the env var for litellm, and see if that works instead @vaghelarahul94
Hi @krrishdholakia Thanks for your response! I appreciate it.
I updated the code to use the os.environ["GOOGLE_APPLICATION_CREDENTIALS"]="PATH_TO_JSON"
environment variable. Additionally, I commented out a few other sections.
response = completion(
model="vertex_ai/gemini-pro",
messages=[{"content": "You are a good bot.","role": "system"}, {"content": "tell me poem on pasta","role": "user"}],
#vertex_credentials=vertex_credentials_json,
#vertex_project="my_project_id",
#vertex_location="us-central1"
)
I am now seeing that litellm SDK is asking for this role serviceUsageConsumer ? Whereas vertex ai sdk didn't ask for it. Why when using via litellm sdk this is happening?
litellm.exceptions.BadRequestError: litellm.BadRequestError: VertexAIException BadRequestError - ('Unable to acquire impersonated credentials', '{\n "error": {\n "code": 403,\n "message": "Caller does not have required permission to use project my_project_id. Grant the caller the roles/serviceusage.serviceUsageConsumer role, or a custom role with the serviceusage.services.use permission, by visiting https://console.developers.google.com/iam-admin/iam/project?project=my_project_id and then retry. Propagation of the new permission may take a few minutes.",\n "status": "PERMISSION_DENIED",\n "details": [\n {\n "@type": "type.googleapis.com/google.rpc.Help",\n "links": [\n {\n "description": "Google developer console IAM admin",\n "url": "https://console.developers.google.com/iam-admin/iam/project?project=my_project_id"\n }\n ]\n },\n {\n "@type": "type.googleapis.com/google.rpc.ErrorInfo",\n "reason": "USER_PROJECT_DENIED",\n "domain": "googleapis.com",\n "metadata": {\n "service": "iamcredentials.googleapis.com",\n "consumer": "projects/my_project_id"\n }\n }\n ]\n }\n}\n')
What happened?
When using litellm SDK version 1.48.7 like this:
We are seeing error with stack trace:
Whereas when I use vertex ai SDK itself like this with my same service account credentials file like this:
Then it works fine.
My service account file looks like this:
Relevant log output
No response
Twitter / LinkedIn details
No response