A class of random fields on complete graphs with tractable partition function