Pointwise log-likelihood for loo/waic with custom "black-box" probability distribution

How exactly can I do this? I’ve read posts about using DensityDist but I’m not sure how to implement this.

I currently use pm.Potential(“likelihood”, logl(theta)), which works well, but it does not let me compare models using WAIC or LOO.

I then tried pm.DensityDist(“likelihood”, logp = logl(theta), observed = data), but this results in an error Logprob method not implemented for CustomDist_likelihood_rv{0, (), floatX, False}. I guess my implementation of density dist is wrong but I am quite new to this and not sure how to proceed.

Any help would be appreciated