From d83c2b9ee80cd9ffe29dcb67a3879ada74a087c1 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 20 Nov 2023 20:49:02 -0800 Subject: [PATCH] fix(main.py): fix model alias map logic --- litellm/main.py | 5 ----- litellm/utils.py | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/litellm/main.py b/litellm/main.py index 07d1ec82c0..746c26a38d 100644 --- a/litellm/main.py +++ b/litellm/main.py @@ -356,11 +356,6 @@ def completion( if model_list is not None: deployments = [m["litellm_params"] for m in model_list if m["model_name"] == model] return batch_completion_models(deployments=deployments, **args) - if litellm.model_alias_map and model in litellm.model_alias_map: - args["model_alias_map"] = litellm.model_alias_map - model = litellm.model_alias_map[ - model - ] # update the model to the actual value if an alias has been passed in model_response = ModelResponse() diff --git a/litellm/utils.py b/litellm/utils.py index b47d9554e3..b0bd9e3dd3 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -2247,6 +2247,12 @@ def get_llm_provider(model: str, custom_llm_provider: Optional[str] = None, api_ try: dynamic_api_key = None # check if llm provider provided + + if litellm.model_alias_map and model in litellm.model_alias_map: + model = litellm.model_alias_map[ + model + ] # update the model to the actual value if an alias has been passed in + if custom_llm_provider: return model, custom_llm_provider, dynamic_api_key, api_base