We characterize which graph parameters are partition functions of a vertex model over an algebraically closed field of characteristic 0 (in the sense of [P. de la Harpe, V.F.R. Jones, Graph invariants related to statistical mechanical models: examples and problems, J. Combin. Theory Ser. B 57 (1993) 207–227]). We moreover characterize when the vertex model can be taken so that its moment matrix has finite rank. Basic instruments are the Nullstellensatz and the First and Second Fundamental Theorems of Invariant theory for the orthogonal group. Keywords: Vertex model; Partition function; Graph invariant; First Fundamental Theorem; Second Fundamental Theorem; Invariant theory; Orthogonal grou