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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Fix greptile comments
Sameer Kankute303072dc44ed
diff --git a/litellm/proxy/management_endpoints/model_management_endpoints.py b/litellm/proxy/management_endpoints/model_management_endpoints.pyindex 40f4d722dc6..1acedfb346a 100644--- a/litellm/proxy/management_endpoints/model_management_endpoints.py+++ b/litellm/proxy/management_endpoints/model_management_endpoints.py@@ -468,7 +468,13 @@ async def _update_existing_team_model_assignment(user_api_key_dict: UserAPIKeyAuth,prisma_client: Optional[PrismaClient],) -> None:- """Update an existing team model if the public name changed."""+ """Update an existing team model if the public name changed.++ Note on DB scan: Prisma's JSON filtering does not support compound AND conditions+ across multiple JSON paths, so we fetch all deployments for the team and filter+ team_public_model_name in Python. For teams with many deployments this scan grows+ linearly; if team deployment counts become large this should be revisited.+ """def _get_team_public_model_name(model_info: Optional[Union[dict, str]]@@ -496,10 +502,6 @@ async def _update_existing_team_model_assignment("prisma_client not initialized; skipping old public name cleanup to preserve sibling deployments")else:- # Query DB for all deployments in this team, then filter by public name.- # Note: Prisma's JSON filtering doesn't support compound AND conditions- # across multiple JSON paths, so we filter team_public_model_name in Python.- # For most teams (typically <100 deployments), this is acceptable.response = await prisma_client.db.litellm_proxymodeltable.find_many(where={"model_info": {@@ -508,12 +510,15 @@ async def _update_existing_team_model_assignment(}})- other_deployments_with_old_name = [- d- for d in response- if d.model_name != db_model.model_name- and _get_team_public_model_name(d.model_info) == old_public_name- ]+ if not response:+ other_deployments_with_old_name = []+ else:+ other_deployments_with_old_name = [+ d+ for d in response+ if d.model_name != db_model.model_name+ and _get_team_public_model_name(d.model_info) == old_public_name+ ]if not other_deployments_with_old_name:await team_model_delete(diff --git a/litellm/router.py b/litellm/router.pyindex 1a57d2f8c0d..ac965a0af5b 100644--- a/litellm/router.py+++ b/litellm/router.py@@ -8258,6 +8258,10 @@ class Router:# O(k) where k = team deployments for this model_name (typically 1-10)for idx in indices:model = self.model_list[idx]+ if not self.should_include_deployment(+ model_name=model_name, model=model, team_id=team_id+ ):+ continueif model_alias is not None:alias_model = model.copy()alias_model["model_name"] = model_alias