Markov random field potentials

Consider a pairwise Markov random field, for any two neighbours $A$ and $B$, is it correct to use any function to describe the relationship between them? Is there any constraint or any condition that a function needs to be satisfied to be a valid potential function $\phi(A,B)$?

A density of the form$$\mathbb{P}(X=x)=\exp\left\{\sum_{A\sim B}\phi(A,B)\right\}\Big/\mathfrak{Z}_\phi$$(where $A\sim B$ means that $A$ and $B$ are neighbours) is valid as a probability density provided the normalisation constant $\mathfrak{Z}_\phi$ is finite.
It is the probability density of a Markov random field if the associated random vector $X$ satisfies local and global Markov properties, that is, each component of $X$ is independent of all other components given its neighbours and two subsets of variables are conditionally independent given a separating subset. This is ensured by the above representation with no condition on $\phi(\cdot,\cdot)$ and in fact is characteristic of MRFs, as expressed in the Wikipedia entry reproduced below: • Assume the support of both $A$ and $B$ is $(-\infty,+\infty)$. A function $f(a,b) = (a-b)^2$ and its range is $(0,+\infty)$. $f$ cannot be used as a potential function to install $\phi(A,B)$ since $\iint_{A,B} f(a,b)da db$ is not finite? – Yi Yang Mar 15 '18 at 9:22