Skip to content

Commit

Permalink
Only init vertex if the model is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
calvingiles committed Sep 25, 2024
1 parent e2171c1 commit ea8744c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ai/providers/vertexai.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ class VertexAPI(BaseAPIProvider):

def __init__(self):
self.enabled = bool(os.environ.get("VERTEX_AI_PROJECT_ID", ""))
vertexai.init(project=os.environ.get("VERTEX_AI_PROJECT_ID"), location=os.environ.get("VERTEX_AI_LOCATION"))
if self.enabled:
vertexai.init(
project=os.environ.get("VERTEX_AI_PROJECT_ID"),
location=os.environ.get("VERTEX_AI_LOCATION"),
)

def set_model(self, model_name: str):
if model_name not in self.MODELS.keys():
Expand Down

0 comments on commit ea8744c

Please sign in to comment.