Change quota project to the correct project being used for the call

if not set it will use the default project in the ADC to set that quota project which is usually different 
https://github.com/googleapis/python-aiplatform/issues/2557#issuecomment-1709284744
This commit is contained in:
Eslam karim gaber 2024-01-28 19:55:01 +02:00 committed by GitHub
parent 562f9641c0
commit 173e32bfa9

View file

@ -237,8 +237,10 @@ def completion(
GenerationConfig,
)
from google.cloud.aiplatform_v1beta1.types import content as gapic_content_types
vertexai.init(project=vertex_project, location=vertex_location)
## Load credentials with the correct quota project ref: https://github.com/googleapis/python-aiplatform/issues/2557#issuecomment-1709284744
creds, _ = google.auth.default(quota_project_id=vertex_project)
vertexai.init(project=vertex_project, location=vertex_location, credentials=creds)
## Load Config
config = litellm.VertexAIConfig.get_config()