mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
fix(vertex_ai.py): raise exception if vertex ai missing required dependendencies
This commit is contained in:
parent
cca852ce42
commit
40364daac7
1 changed files with 8 additions and 0 deletions
|
@ -216,6 +216,14 @@ def completion(
|
||||||
status_code=400,
|
status_code=400,
|
||||||
message="vertexai import failed please run `pip install google-cloud-aiplatform`",
|
message="vertexai import failed please run `pip install google-cloud-aiplatform`",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if not (
|
||||||
|
hasattr(vertexai, "preview") or hasattr(vertexai.preview, "language_models")
|
||||||
|
):
|
||||||
|
raise VertexAIError(
|
||||||
|
status_code=400,
|
||||||
|
message="""Upgrade vertex ai. Run `pip install "google-cloud-aiplatform>=1.38"`""",
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
from vertexai.preview.language_models import (
|
from vertexai.preview.language_models import (
|
||||||
ChatModel,
|
ChatModel,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue