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]

fix: replace unsupported Prisma JSON path filter in _get_team_deployments

Yuneng Jiang8e6300f0bf50
diff --git a/litellm/proxy/management_endpoints/model_management_endpoints.py b/litellm/proxy/management_endpoints/model_management_endpoints.py
index 2ca8e3daba3..754727d4716 100644
--- a/litellm/proxy/management_endpoints/model_management_endpoints.py
+++ b/litellm/proxy/management_endpoints/model_management_endpoints.py
@@ -485,18 +485,31 @@ async def _get_team_deployments(
Centralizes team deployment queries to ensure consistent filtering and error handling.
This is the established helper pattern for team deployment DB access in this module.
- Note: Direct Prisma call is intentional here as this IS the helper function that
- encapsulates the DB access pattern for team deployments.
+ Note: prisma-client-py 0.11.0 does not support JSON path filtering, so we filter
+ by the model_name prefix (team models use "model_name_{team_id}_*") and confirm
+ team_id in model_info with Python-side filtering.
"""
+ prefix = f"model_name_{team_id}_"
response = await prisma_client.db.litellm_proxymodeltable.find_many(
where={
- "model_info": {
- "path": ["team_id"],
- "equals": team_id,
- }
+ "model_name": {"startswith": prefix},
}
)
- return response if response else []
+ if not response:
+ return []
+
+ # Confirm team_id in model_info (defensive check)
+ result = []
+ for row in response:
+ model_info = row.model_info
+ if isinstance(model_info, str):
+ try:
+ model_info = json.loads(model_info)
+ except (TypeError, ValueError):
+ continue
+ if isinstance(model_info, dict) and model_info.get("team_id") == team_id:
+ result.append(row)
+ return result
async def _update_existing_team_model_assignment(