Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Revert "fix(router.py): return model alias w/ underlying deployment on router.get_model_list()"

Krrish Dholakia0a016d33e635
diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml
index bf86da1e12a..335e9344754 100644
--- a/litellm/proxy/_new_secret_config.yaml
+++ b/litellm/proxy/_new_secret_config.yaml
@@ -1,9 +1,16 @@
model_list:
- - model_name: "gpt-turbo"
+ - model_name: "anthropic/claude-3-5-sonnet-20240620"
litellm_params:
- model: azure/chatgpt-v-2
- api_key: os.environ/AZURE_API_KEY
- api_base: os.environ/AZURE_API_BASE
+ model: anthropic/claude-3-5-sonnet-20240620
+ # api_base: http://0.0.0.0:9000
+ - model_name: gpt-3.5-turbo
+ litellm_params:
+ model: openai/*
-router_settings:
- model_group_alias: {"gpt-4": "gpt-turbo"}
\ No newline at end of file
+litellm_settings:
+ success_callback: ["s3"]
+ s3_callback_params:
+ s3_bucket_name: litellm-logs # AWS Bucket Name for S3
+ s3_region_name: us-west-2 # AWS Region Name for S3
+ s3_aws_access_key_id: os.environ/AWS_ACCESS_KEY_ID # us os.environ/<variable name> to pass environment variables. This is AWS Access Key ID for S3
+ s3_aws_secret_access_key: os.environ/AWS_SECRET_ACCESS_KEY # AWS Secret Access Key for S3
\ No newline at end of file
diff --git a/litellm/proxy/health_check.py b/litellm/proxy/health_check.py
index 215d2d8d601..ff5ed7bfb75 100644
--- a/litellm/proxy/health_check.py
+++ b/litellm/proxy/health_check.py
@@ -3,7 +3,7 @@
import asyncio
import logging
import random
-from typing import List, Optional
+from typing import Optional
import litellm
from litellm._logging import print_verbose
@@ -36,25 +36,6 @@ def _clean_endpoint_data(endpoint_data: dict, details: Optional[bool] = True):
)
-def filter_deployments_by_id(
- model_list: List,
-) -> List:
- seen_ids = set()
- filtered_deployments = []
-
- for deployment in model_list:
- _model_info = deployment.get("model_info") or {}
- _id = _model_info.get("id") or None
- if _id is None:
- continue
-
- if _id not in seen_ids:
- seen_ids.add(_id)
- filtered_deployments.append(deployment)
-
- return filtered_deployments
-
-
async def _perform_health_check(model_list: list, details: Optional[bool] = True):
"""
Perform a health check for each model in the list.
@@ -124,9 +105,6 @@ async def perform_health_check(
_new_model_list = [x for x in model_list if x["model_name"] == model]
model_list = _new_model_list
- model_list = filter_deployments_by_id(
- model_list=model_list
- ) # filter duplicate deployments (e.g. when model alias'es are used)
healthy_endpoints, unhealthy_endpoints = await _perform_health_check(
model_list, details
)
diff --git a/litellm/router.py b/litellm/router.py
index 57706b63735..bcd0b6221de 100644
--- a/litellm/router.py
+++ b/litellm/router.py
@@ -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
diff --git a/proxy_server_config.yaml b/proxy_server_config.yaml
index b1d6b3dc661..57113d3509d 100644
--- a/proxy_server_config.yaml
+++ b/proxy_server_config.yaml
@@ -148,7 +148,6 @@ router_settings:
redis_password: os.environ/REDIS_PASSWORD
redis_port: os.environ/REDIS_PORT
enable_pre_call_checks: true
- model_group_alias: {"my-special-fake-model-alias-name": "fake-openai-endpoint-3"}
general_settings:
master_key: sk-1234 # [OPTIONAL] Use to enforce auth on proxy. See - https://docs.litellm.ai/docs/proxy/virtual_keys