added minimum expected version of SDK to the error description (#8712)

#7932

Co-authored-by: Leonid Kuligin <kuligin@google.com>
pull/8694/head
Leonid Kuligin 1 year ago committed by GitHub
parent 814faa9de5
commit 2928a1a3c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -111,7 +111,7 @@ class ChatVertexAI(_VertexAICommon, BaseChatModel):
values["client"] = ChatModel.from_pretrained(values["model_name"])
except ImportError:
raise_vertex_import_error()
raise_vertex_import_error(minimum_expected_version="1.28.0")
return values
def _generate(

@ -5,15 +5,17 @@ if TYPE_CHECKING:
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.
Args:
minimum_expected_version: The lowest expected version of the SDK.
Raises:
ImportError: an ImportError that mentions a required version of the SDK.
"""
sdk = "'google-cloud-aiplatform>=1.26.1'"
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…
Cancel
Save