What category is the universal property of the Free Group a diagram in? wikipedia says that the free group is defined by a universal property:

The free group $F_S$ is the universal group generated by the set $S$. This can be formalized by the following universal property: given any function $f$ from $S$ to a group $G$, there exists a unique homomorphism $φ: F_S → G$ making the following diagram commute (where the unnamed mapping denotes the inclusion from $S$ into $F_S$):




My question is, in what category is this a diagram? Is it in Grp or Set? Either way I'm confused, because $S$ is not a group, suggesting it's in Set, but the uniqueness of $\phi$ only holds for homomorphisms, not general functions, suggesting this is in Grp.

I often think of the free group over $S$ to be the initial object in the category of groups with $S$ specified points, or more formally the category of groups $(G, *)$ along with a specified function from $S$ to $G$, where morphisms consist of a group homomorphism that makes the functions from $S$ agree.
This definition captures what the diagram is trying to convey: it is showing initiality of $F_S$ where the morphism consists of the whole wedge coming out of $S$.
As other answers have said, this construction results in a functor from $\mathbf{Set}$ to $\mathbf{Grp}$, which is left adjoint to the forgetful functor, but I don't believe this context (while fascinating, and points to many interesting generalizations) is necessary to understand the free group.
