This is called an $L$-valued relation, when $L$ is the target of the function, which can be viewed as the collection of possible truth values.
Thus, a $2$-valued relation is just an ordinary relation of classical logic, where every instance has truth value either true or false. But for any Boolean algebra $\mathbb{B}$ we have $\mathbb{B}$-valued relations, which arise throughout forcing, or more generally with a Heyting algebra, or an $\mathbb{R}^+$-valued [0,1]$-valued relation, as in fuzzy logic.

