Revert "Litellm tuesday cicd release"#20330
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile OverviewGreptile SummaryThis PR reverts #20328, restoring three main changes: 1. Database Performance Improvements
2. Access Group Filtering (Issue #18333 Fix)
3. MCP Test Cleanup
Key Issues:
Confidence Score: 2/5
|
| Filename | Overview |
|---|---|
| litellm/proxy/litellm_pre_call_utils.py | Adds llm_router.get_model_access_groups() call on every request, which iterates over model list and may cause performance degradation |
| litellm/router_utils/common_utils.py | Adds filter_deployments_by_access_groups function to fix cross-team loadbalancing issue (#18333), logic looks correct |
| litellm/router.py | Integrates access group filter into deployment selection, simple addition to existing filter chain |
| litellm-proxy-extras/litellm_proxy_extras/migrations/20260129103648_add_verificationtoken_indexes/migration.sql | Adds database indexes on VerificationToken table to improve query performance |
Sequence Diagram
sequenceDiagram
participant Client
participant Proxy as Proxy (litellm_pre_call_utils)
participant Router as Router
participant Filter as filter_deployments_by_access_groups
participant Deployment as Deployment Selection
Client->>Proxy: API Request with API Key
Note over Proxy: add_litellm_data_to_request()
alt llm_router exists
Proxy->>Router: get_model_access_groups()
Note over Router: Iterates over ALL models<br/>in model_list (performance concern)
Router-->>Proxy: model_access_groups dict
Proxy->>Proxy: get_access_groups_from_models()<br/>for key models
Proxy->>Proxy: get_access_groups_from_models()<br/>for team models
Note over Proxy: Store in metadata:<br/>- user_api_key_allowed_access_groups<br/>- user_api_key_team_allowed_access_groups
end
Proxy->>Router: Route request
Note over Router: Get healthy deployments
Router->>Filter: filter_deployments_by_access_groups()
Note over Filter: Read access groups from metadata<br/>Filter deployments by access_groups
Filter-->>Router: Filtered deployments
Router->>Deployment: Select from filtered deployments
Deployment-->>Client: Response
| if llm_router is not None: | ||
| from litellm.proxy.auth.model_checks import get_access_groups_from_models | ||
|
|
||
| model_access_groups = llm_router.get_model_access_groups() |
There was a problem hiding this comment.
Calling llm_router.get_model_access_groups() on every request may cause performance issues. This method calls get_model_list() and iterates over all models (line 7530-7542 in router.py), which could be expensive for routers with many models. Consider caching the result or moving this computation outside the critical request path.
Context Used: Rule from dashboard - What: Avoid creating new database requests or Router objects in the critical request path.
Why: Cre... (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: litellm/proxy/litellm_pre_call_utils.py
Line: 1028:1031
Comment:
Calling `llm_router.get_model_access_groups()` on every request may cause performance issues. This method calls `get_model_list()` and iterates over all models (line 7530-7542 in `router.py`), which could be expensive for routers with many models. Consider caching the result or moving this computation outside the critical request path.
**Context Used:** Rule from `dashboard` - What: Avoid creating new database requests or Router objects in the critical request path.
Why: Cre... ([source](https://app.greptile.com/review/custom-context?memory=0c2a17ad-5f29-423f-a48b-371852ac4169))
How can I resolve this? If you propose a fix, please make it concise.
Reverts #20328