update 02 staging PR#20337
Conversation
…drail [Fix] UI - Team Settings: Disable Global Guardrail Persistence
[Feature] Key reset_spend endpoint
…down [Feature] UI - SSO: Add Team Mappings
* init: SemanticMCPToolFilter * init: SemanticToolFilterHook * test_e2e_semantic_filter * mock tests: test_semantic_filter_basic_filtering * Update litellm/proxy/_experimental/mcp_server/semantic_tool_filter.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * refactor folder/file organization * docs fix * fix filter * fix: filter_tools * fix linting tool filrer * initialize_from_config * fix: _expand_mcp_tools * _initialize_semantic_tool_filter * working: async_post_call_response_headers_hook * clean up semantic tool filter * add _initialize_semantic_tool_filter * build_router_from_mcp_registry * _get_tools_by_names * fiix config * async_post_call_response_headers_hook --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
* init: SemanticMCPToolFilter * init: SemanticToolFilterHook * test_e2e_semantic_filter * mock tests: test_semantic_filter_basic_filtering * Update litellm/proxy/_experimental/mcp_server/semantic_tool_filter.py Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * refactor folder/file organization * docs fix * fix filter * fix: filter_tools * fix linting tool filrer * initialize_from_config * fix: _expand_mcp_tools * _initialize_semantic_tool_filter * working: async_post_call_response_headers_hook * clean up semantic tool filter * add _initialize_semantic_tool_filter * build_router_from_mcp_registry * _get_tools_by_names * fiix config * async_post_call_response_headers_hook * docs mcp filter * docs fix --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
…arch` with VertexAI/gemini models (#20280) * test_gemini_openai_web_search_tool_to_google_search * feat: Handle OpenAI style web search tools
Add documentation correctly for nova sonic
[Feature] UI - Default Team Settings: Migrate Default Team Settings to use Reusable Model Select
[Feature] UI - Navbar: Option to Hide Community Engagement Buttons
…mantic_tool_filter.py tests
This reverts commit 1e8848c.
Litellm tuesday cicd release
…icd_release Revert "Litellm tuesday cicd release"
…mantic_tool_filter.py tests
This reverts commit 1e8848c.
…inal Litellm tuesday cicd release final
bump litellm 1.81.7
b7f0d05
into
litellm_oss_staging_02_03_2026
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile OverviewGreptile SummaryThis staging PR combines several significant changes: Major Changes:
Key Concerns:
Confidence Score: 3/5
|
| Filename | Overview |
|---|---|
| litellm/router_utils/common_utils.py | Removed filter_deployments_by_access_groups function and its usage - reverting feature #18333 |
| litellm/router.py | Removed access group filtering from router, removing cross-team load balancing protection |
| litellm/proxy/litellm_pre_call_utils.py | Removed access group metadata extraction for keys and teams from request processing |
| litellm/proxy/proxy_server.py | Added semantic tool filter initialization during proxy startup, creating Router object in startup path |
| litellm/proxy/hooks/mcp_semantic_filter/hook.py | New pre-call hook for semantic filtering of MCP tools using embeddings and semantic similarity |
| litellm/proxy/management_endpoints/key_management_endpoints.py | Added new /key/{key}/reset_spend endpoint with validation logic for resetting key spend to lower values |
| litellm/router_utils/fallback_event_handlers.py | Simplified fallback depth check by removing redundant model group length validation |
| litellm-proxy-extras/litellm_proxy_extras/migrations/20260129103648_add_verificationtoken_indexes/migration.sql | Deleted migration file that added database indexes - potentially breaking for deployed instances |
Sequence Diagram
sequenceDiagram
participant Client
participant ProxyServer
participant SemanticFilterHook
participant SemanticMCPToolFilter
participant Router as LiteLLM Router
participant LLM as LLM Provider
Note over ProxyServer: Startup Phase
ProxyServer->>SemanticFilterHook: initialize_from_config()
SemanticFilterHook->>SemanticMCPToolFilter: new(embedding_model, router, top_k)
SemanticMCPToolFilter->>SemanticMCPToolFilter: build_router_from_mcp_registry()
Note over SemanticMCPToolFilter: Fetches all MCP tools<br/>and builds semantic index
SemanticFilterHook-->>ProxyServer: hook registered
Note over Client,LLM: Request Phase
Client->>ProxyServer: POST /chat/completions<br/>{messages, tools: [...]}
ProxyServer->>SemanticFilterHook: async_pre_call_hook(data)
alt MCP tools with litellm_proxy reference
SemanticFilterHook->>SemanticFilterHook: _expand_mcp_tools()
Note over SemanticFilterHook: Expands MCP references<br/>to full tool definitions
end
SemanticFilterHook->>SemanticFilterHook: extract_user_query(messages)
SemanticFilterHook->>SemanticMCPToolFilter: filter_tools(query, tools)
SemanticMCPToolFilter->>Router: aembedding(query)
Router->>LLM: Generate embedding
LLM-->>Router: embedding vector
Router-->>SemanticMCPToolFilter: query embedding
SemanticMCPToolFilter->>SemanticMCPToolFilter: Calculate similarity scores
SemanticMCPToolFilter-->>SemanticFilterHook: filtered_tools (top_k)
SemanticFilterHook->>SemanticFilterHook: Update data["tools"]<br/>Add filter stats to metadata
SemanticFilterHook-->>ProxyServer: modified data
ProxyServer->>LLM: completion(messages, filtered_tools)
LLM-->>ProxyServer: response
ProxyServer->>SemanticFilterHook: async_post_call_response_headers_hook()
SemanticFilterHook-->>ProxyServer: headers with filter stats
ProxyServer-->>Client: response + headers<br/>(x-litellm-semantic-filter)
| ## SEMANTIC TOOL FILTER ## | ||
| # Read litellm_settings from config for semantic filter initialization | ||
| try: | ||
| verbose_proxy_logger.debug("About to initialize semantic tool filter") | ||
| _config = proxy_config.get_config_state() | ||
| _litellm_settings = _config.get("litellm_settings", {}) | ||
| verbose_proxy_logger.debug(f"litellm_settings keys = {list(_litellm_settings.keys())}") | ||
| await ProxyStartupEvent._initialize_semantic_tool_filter( | ||
| llm_router=llm_router, | ||
| litellm_settings=_litellm_settings, | ||
| ) | ||
| verbose_proxy_logger.debug("After semantic tool filter initialization") | ||
| except Exception as e: | ||
| verbose_proxy_logger.error(f"Semantic filter init failed: {e}", exc_info=True) |
There was a problem hiding this comment.
The semantic filter initialization occurs during startup and calls build_router_from_mcp_registry() which may involve network calls to fetch tools from MCP servers. This violates the custom rule about avoiding expensive operations during startup. Consider lazy initialization on first use instead.
Context Used: Rule from dashboard - What: Avoid creating new database requests or Router objects in the critical request path.
Why: Cre... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: litellm/proxy/proxy_server.py
Line: 796:809
Comment:
The semantic filter initialization occurs during startup and calls `build_router_from_mcp_registry()` which may involve network calls to fetch tools from MCP servers. This violates the custom rule about avoiding expensive operations during startup. Consider lazy initialization on first use instead.
**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))
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
Additional Comments (1)
If these indexes were causing issues, the proper approach is:
Prompt To Fix With AIThis is a comment left during a code review.
Path: litellm-proxy-extras/litellm_proxy_extras/migrations/20260129103648_add_verificationtoken_indexes/migration.sql
Line: 1:8
Comment:
Deleting a migration file is dangerous for production deployments. If this migration was already applied to deployed databases, removing it from the codebase can cause migration state inconsistencies. Consider reverting the indexes with a new DOWN migration instead of deleting the file.
If these indexes were causing issues, the proper approach is:
1. Keep this migration file
2. Create a new migration that drops the indexes
3. Document why they were removed
How can I resolve this? If you propose a fix, please make it concise. |
Relevant issues
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unitCI (LiteLLM team)
Branch creation CI run
Link:
CI run for the last commit
Link:
Merge / cherry-pick CI run
Links:
Type
🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test
Changes