Reproducing scib-metrics usage after API change


I used to be able to run

from scib_metrics import lisi_knn
labels = adata.obs.perturbation_name.values
labels = np.asarray(pd.Categorical(labels).codes)
adata.obs['lisi'] = lisi_knn(adata.obsp['distances'], labels, perplexity=None)

However, the input to lisi_knn has since changed to a NeighborsResult object, which I cannot figure out how to generate. Could an example please be provided so that I can continue using these metrics?