mirror of
https://github.com/hwchase17/langchain
synced 2024-11-04 06:00:26 +00:00
added minimum expected version of SDK to the error description (#8712)
#7932 Co-authored-by: Leonid Kuligin <kuligin@google.com>
This commit is contained in:
parent
814faa9de5
commit
2928a1a3c9
@ -111,7 +111,7 @@ class ChatVertexAI(_VertexAICommon, BaseChatModel):
|
|||||||
|
|
||||||
values["client"] = ChatModel.from_pretrained(values["model_name"])
|
values["client"] = ChatModel.from_pretrained(values["model_name"])
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise_vertex_import_error()
|
raise_vertex_import_error(minimum_expected_version="1.28.0")
|
||||||
return values
|
return values
|
||||||
|
|
||||||
def _generate(
|
def _generate(
|
||||||
|
@ -5,15 +5,17 @@ if TYPE_CHECKING:
|
|||||||
from google.auth.credentials import Credentials
|
from google.auth.credentials import Credentials
|
||||||
|
|
||||||
|
|
||||||
def raise_vertex_import_error() -> None:
|
def raise_vertex_import_error(minimum_expected_version: str = "1.26.1") -> None:
|
||||||
"""Raise ImportError related to Vertex SDK being not available.
|
"""Raise ImportError related to Vertex SDK being not available.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
minimum_expected_version: The lowest expected version of the SDK.
|
||||||
Raises:
|
Raises:
|
||||||
ImportError: an ImportError that mentions a required version of the SDK.
|
ImportError: an ImportError that mentions a required version of the SDK.
|
||||||
"""
|
"""
|
||||||
sdk = "'google-cloud-aiplatform>=1.26.1'"
|
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
"Could not import VertexAI. Please, install it with " f"pip install {sdk}"
|
"Could not import VertexAI. Please, install it with "
|
||||||
|
f"pip install google-cloud-aiplatform>={minimum_expected_version}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user