From cfebbdfa7b554b8bf8281d274cc292a38af424b7 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Tue, 27 Feb 2024 06:48:09 -0800 Subject: [PATCH 1/2] (fix) support mistral on azure ai studio --- litellm/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/utils.py b/litellm/utils.py index 4502e14de2..356fdbc4e3 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -4928,7 +4928,7 @@ def get_llm_provider( dynamic_api_key = get_secret("GROQ_API_KEY") elif custom_llm_provider == "mistral": # 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 = "https://api.mistral.ai/v1" + api_base = api_base or "https://api.mistral.ai/v1" dynamic_api_key = get_secret("MISTRAL_API_KEY") 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 From e56cc26e18b83aa39617b7d2cf8ce3c1e3dfee87 Mon Sep 17 00:00:00 2001 From: ishaan-jaff Date: Tue, 27 Feb 2024 06:49:42 -0800 Subject: [PATCH 2/2] (test) mistral on azure ai studio --- litellm/tests/test_get_llm_provider.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/litellm/tests/test_get_llm_provider.py b/litellm/tests/test_get_llm_provider.py index cf28f2d0d7..e443830b2f 100644 --- a/litellm/tests/test_get_llm_provider.py +++ b/litellm/tests/test_get_llm_provider.py @@ -18,4 +18,17 @@ def test_get_llm_provider(): assert response == "bedrock" -test_get_llm_provider() +# test_get_llm_provider() + + +def test_get_llm_provider_mistral_custom_api_base(): + model, custom_llm_provider, dynamic_api_key, api_base = litellm.get_llm_provider( + model="mistral/mistral-large-fr", + api_base="https://mistral-large-fr-ishaan.francecentral.inference.ai.azure.com/v1", + ) + assert custom_llm_provider == "mistral" + assert model == "mistral-large-fr" + assert ( + api_base + == "https://mistral-large-fr-ishaan.francecentral.inference.ai.azure.com/v1" + )