Generalized adiabatic connection in density functional theory