diff --git a/litellm/llms/you_com/search/transformation.py b/litellm/llms/you_com/search/transformation.py index 9a2144b2cb0..3c94b991735 100644 --- a/litellm/llms/you_com/search/transformation.py +++ b/litellm/llms/you_com/search/transformation.py @@ -93,7 +93,7 @@ class YouComSearchConfig(BaseSearchConfig): api_base = get_secret_str("YOUCOM_API_BASE") if api_base is None: - api_key = get_secret_str("YOUCOM_API_KEY") + api_key = kwargs.get("api_key") or get_secret_str("YOUCOM_API_KEY") if api_key: api_base = self.YOU_COM_API_BASE else: diff --git a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py index 7deff9d9b38..6afe9a2f9a5 100644 --- a/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py +++ b/tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py @@ -3157,8 +3157,19 @@ class TestMCPServerTimestamps: timeout=2.0, ) + async def _slow_call(*args, **kwargs): + await asyncio.sleep(999) + mock_client = AsyncMock() - mock_client.call_tool = AsyncMock(side_effect=asyncio.CancelledError()) + mock_client.call_tool = _slow_call + + server = MCPServer( + server_id="timeout-tool-server", + name="timeout_tool_server", + url="https://example.com/mcp", + transport=MCPTransport.http, + timeout=0.01, + ) with patch.object(manager, "_create_mcp_client", return_value=mock_client): with pytest.raises(HTTPException) as exc_info: @@ -3176,7 +3187,7 @@ class TestMCPServerTimestamps: assert exc_info.value.status_code == 504 assert exc_info.value.detail["error"] == "timeout" - assert "2.0s" in exc_info.value.detail["message"] + assert "0.01s" in exc_info.value.detail["message"] class TestInternalDelegatePkceWarningLog: