(feat) use mistral azure with env vars

This commit is contained in:
ishaan-jaff 2024-02-29 08:28:46 -08:00
parent 817fa2483a
commit ec70cdc558

View file

@ -5005,13 +5005,13 @@ def get_llm_provider(
# mistral is openai compatible, we just need to set this to custom_openai and have the api_base be https://api.mistral.ai # mistral is openai compatible, we just need to set this to custom_openai and have the api_base be https://api.mistral.ai
api_base = ( api_base = (
api_base api_base
or get_secret("MISTRAL_API_BASE") or get_secret("MISTRAL_AZURE_API_BASE")
or "https://api.mistral.ai/v1" or "https://api.mistral.ai/v1"
) )
# if api_base does not end with /v1 we add it # if api_base does not end with /v1 we add it
if api_base is not None and not api_base.endswith("/v1"): if api_base is not None and not api_base.endswith("/v1"):
api_base = api_base + "/v1" api_base = api_base + "/v1"
dynamic_api_key = api_key or get_secret("MISTRAL_API_KEY") dynamic_api_key = api_key or get_secret("MISTRAL_AZURE_API_KEY")
elif custom_llm_provider == "voyage": elif custom_llm_provider == "voyage":
# voyage is openai compatible, we just need to set this to custom_openai and have the api_base be https://api.voyageai.com/v1 # voyage is openai compatible, we just need to set this to custom_openai and have the api_base be https://api.voyageai.com/v1
api_base = "https://api.voyageai.com/v1" api_base = "https://api.voyageai.com/v1"