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]

Merge pull request #19818 from Quentin-M/search_tools_fix

yuneng-jiang93383d096638
diff --cc litellm/proxy/proxy_server.py
index f12d4d6ab4c,056367243f9..053301d8ced
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@@ -3227,21 -3173,20 +3227,22 @@@ class ProxyConfig
_model_list: list = self.decrypt_model_list_from_db(
new_models=models_list
)
- if len(_model_list) > 0:
- verbose_proxy_logger.debug(f"_model_list: {_model_list}")
- llm_router = litellm.Router(
- model_list=_model_list,
- router_general_settings=RouterGeneralSettings(
- async_only_mode=True # only init async clients
- ),
- search_tools=search_tools,
- ignore_invalid_deployments=True,
- )
- verbose_proxy_logger.debug(f"updated llm_router: {llm_router}")
+ # Create router even with empty model list to support search_tools
+ # Router can function with model_list=[] and only search_tools
+ verbose_proxy_logger.debug(f"_model_list: {_model_list}")
+ llm_router = litellm.Router(
+ model_list=_model_list,
+ router_general_settings=RouterGeneralSettings(
+ async_only_mode=True # only init async clients
+ ),
+ search_tools=search_tools,
+ ignore_invalid_deployments=True,
+ )
+ verbose_proxy_logger.debug(f"updated llm_router: {llm_router}")
else:
verbose_proxy_logger.debug(f"len new_models: {len(models_list)}")
+ if search_tools is not None and llm_router is not None:
+ llm_router.search_tools = search_tools
## DELETE MODEL LOGIC
await self._delete_deployment(db_models=models_list)