mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-07 02:59:05 +00:00
add _initialize_semantic_tool_filter
This commit is contained in:
parent
9f6257ca9c
commit
9464055ca6
2 changed files with 7 additions and 4 deletions
|
|
@ -237,7 +237,7 @@ class SemanticToolFilterHook(CustomLogger):
|
|||
return None
|
||||
|
||||
@staticmethod
|
||||
def initialize_from_config(
|
||||
async def initialize_from_config(
|
||||
config: Optional[Dict[str, Any]],
|
||||
llm_router: Optional["Router"],
|
||||
) -> Optional["SemanticToolFilterHook"]:
|
||||
|
|
@ -282,6 +282,9 @@ class SemanticToolFilterHook(CustomLogger):
|
|||
enabled=True,
|
||||
)
|
||||
|
||||
# Build router from MCP registry on startup
|
||||
await semantic_filter.build_router_from_mcp_registry()
|
||||
|
||||
hook = SemanticToolFilterHook(semantic_filter)
|
||||
|
||||
verbose_proxy_logger.info(
|
||||
|
|
|
|||
|
|
@ -800,7 +800,7 @@ async def proxy_startup_event(app: FastAPI): # noqa: PLR0915
|
|||
_config = proxy_config.get_config_state()
|
||||
_litellm_settings = _config.get("litellm_settings", {})
|
||||
verbose_proxy_logger.debug(f"litellm_settings keys = {list(_litellm_settings.keys())}")
|
||||
ProxyStartupEvent._initialize_semantic_tool_filter(
|
||||
await ProxyStartupEvent._initialize_semantic_tool_filter(
|
||||
llm_router=llm_router,
|
||||
litellm_settings=_litellm_settings,
|
||||
)
|
||||
|
|
@ -4757,7 +4757,7 @@ class ProxyStartupEvent:
|
|||
)
|
||||
|
||||
@classmethod
|
||||
def _initialize_semantic_tool_filter(
|
||||
async def _initialize_semantic_tool_filter(
|
||||
cls,
|
||||
llm_router: Optional[Router],
|
||||
litellm_settings: Dict[str, Any],
|
||||
|
|
@ -4773,7 +4773,7 @@ class ProxyStartupEvent:
|
|||
mcp_semantic_filter_config = litellm_settings.get("mcp_semantic_tool_filter", None)
|
||||
verbose_proxy_logger.debug(f"Semantic filter config: {mcp_semantic_filter_config}")
|
||||
|
||||
hook = SemanticToolFilterHook.initialize_from_config(
|
||||
hook = await SemanticToolFilterHook.initialize_from_config(
|
||||
config=mcp_semantic_filter_config,
|
||||
llm_router=llm_router,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue