mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
Revert "fix(router.py): return model alias w/ underlying deployment on router.get_model_list()"
This reverts commit 638896309c
.
This commit is contained in:
parent
638896309c
commit
0a016d33e6
4 changed files with 20 additions and 59 deletions
|
@ -4556,27 +4556,6 @@ class Router:
|
|||
ids.append(id)
|
||||
return ids
|
||||
|
||||
def _get_all_deployments(
|
||||
self, model_name: str, model_alias: Optional[str] = None
|
||||
) -> List[DeploymentTypedDict]:
|
||||
"""
|
||||
Return all deployments of a model name
|
||||
|
||||
Used for accurate 'get_model_list'.
|
||||
"""
|
||||
|
||||
returned_models: List[DeploymentTypedDict] = []
|
||||
for model in self.model_list:
|
||||
if model["model_name"] == model_name:
|
||||
if model_alias is not None:
|
||||
alias_model = copy.deepcopy(model)
|
||||
alias_model["model_name"] = model_name
|
||||
returned_models.append(alias_model)
|
||||
else:
|
||||
returned_models.append(model)
|
||||
|
||||
return returned_models
|
||||
|
||||
def get_model_names(self) -> List[str]:
|
||||
"""
|
||||
Returns all possible model names for router.
|
||||
|
@ -4588,18 +4567,15 @@ class Router:
|
|||
def get_model_list(
|
||||
self, model_name: Optional[str] = None
|
||||
) -> Optional[List[DeploymentTypedDict]]:
|
||||
"""
|
||||
Includes router model_group_alias'es as well
|
||||
"""
|
||||
if hasattr(self, "model_list"):
|
||||
returned_models: List[DeploymentTypedDict] = []
|
||||
|
||||
for model_alias, model_value in self.model_group_alias.items():
|
||||
returned_models.extend(
|
||||
self._get_all_deployments(
|
||||
model_name=model_value, model_alias=model_alias
|
||||
)
|
||||
model_alias_item = DeploymentTypedDict(
|
||||
model_name=model_alias,
|
||||
litellm_params=LiteLLMParamsTypedDict(model=model_value),
|
||||
)
|
||||
returned_models.append(model_alias_item)
|
||||
|
||||
if model_name is None:
|
||||
returned_models += self.model_list
|
||||
|
@ -4607,7 +4583,8 @@ class Router:
|
|||
return returned_models
|
||||
|
||||
for model in self.model_list:
|
||||
returned_models.extend(self._get_all_deployments(model_name=model_name))
|
||||
if model["model_name"] == model_name:
|
||||
returned_models.append(model)
|
||||
|
||||
return returned_models
|
||||
return None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue