From 0eb1bc1a0245547316fe96ac8f86b0e67acb524f Mon Sep 17 00:00:00 2001 From: Lior Date: Fri, 9 Jun 2023 09:15:22 +0300 Subject: [PATCH] Fix the issue where the parameters passed to VertexAI ignored #5889 (#5891) Fixes #5889 and fixes the name of the argument in init_vertexai @hwchase17 @agola11 Co-authored-by: Lior Durahly --- langchain/llms/vertexai.py | 2 +- langchain/utilities/vertexai.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/langchain/llms/vertexai.py b/langchain/llms/vertexai.py index 58ea7359ec8..16266b49dd5 100644 --- a/langchain/llms/vertexai.py +++ b/langchain/llms/vertexai.py @@ -68,7 +68,7 @@ class _VertexAICommon(BaseModel): @classmethod def _try_init_vertexai(cls, values: Dict) -> None: allowed_params = ["project", "location", "credentials"] - params = {k: v for k, v in values.items() if v in allowed_params} + params = {k: v for k, v in values.items() if k in allowed_params} init_vertexai(**params) return None diff --git a/langchain/utilities/vertexai.py b/langchain/utilities/vertexai.py index 68455873fb5..60050f110be 100644 --- a/langchain/utilities/vertexai.py +++ b/langchain/utilities/vertexai.py @@ -18,7 +18,7 @@ def raise_vertex_import_error() -> None: def init_vertexai( - project_id: Optional[str] = None, + project: Optional[str] = None, location: Optional[str] = None, credentials: Optional["Credentials"] = None, ) -> None: @@ -40,7 +40,7 @@ def init_vertexai( raise_vertex_import_error() vertexai.init( - project=project_id, + project=project, location=location, credentials=credentials, )