diff --git a/litellm/tests/test_model_alias_map.py b/litellm/tests/test_model_alias_map.py index 1501f49e436..31a7d34b8e1 100644 --- a/litellm/tests/test_model_alias_map.py +++ b/litellm/tests/test_model_alias_map.py @@ -16,7 +16,7 @@ litellm.set_verbose = True model_alias_map = {"good-model": "anyscale/meta-llama/Llama-2-7b-chat-hf"} -def test_model_alias_map(): +def test_model_alias_map(caplog): try: litellm.model_alias_map = model_alias_map response = completion( @@ -27,9 +27,15 @@ def test_model_alias_map(): max_tokens=10, ) print(response.model) + + captured_logs = [rec.levelname for rec in caplog.records] + + for log in captured_logs: + assert "ERROR" not in log + assert "Llama-2-7b-chat-hf" in response.model except Exception as e: pytest.fail(f"Error occurred: {e}") -test_model_alias_map() +# test_model_alias_map() diff --git a/litellm/utils.py b/litellm/utils.py index c03d4e2bcf8..5725e4992f1 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -5934,6 +5934,8 @@ def get_api_base(model: str, optional_params: dict) -> Optional[str]: if _optional_params.api_base is not None: return _optional_params.api_base + if litellm.model_alias_map and model in litellm.model_alias_map: + model = litellm.model_alias_map[model] try: model, custom_llm_provider, dynamic_api_key, dynamic_api_base = ( get_llm_provider(