expose vertex ai and hf api base as env var

This commit is contained in:
Krrish Dholakia 2023-09-22 15:14:33 -07:00
parent 4f7a35cbef
commit 9ef0ad9e66
5 changed files with 31 additions and 6 deletions

View file

@ -749,8 +749,10 @@ def completion(
raise Exception("vertexai import failed please run `pip install google-cloud-aiplatform`")
from vertexai.preview.language_models import ChatModel, CodeChatModel, InputOutputTextPair
vertex_project = (litellm.vertex_project or get_secret("VERTEXAI_PROJECT"))
vertex_location = (litellm.vertex_location or get_secret("VERTEXAI_LOCATION"))
vertexai.init(
project=litellm.vertex_project, location=litellm.vertex_location
project=vertex_project, location=vertex_location
)
# vertexai does not use an API key, it looks for credentials.json in the environment