def title_must_have_value(cls: "BaseModel", v: Optional[str], values: Dict[str, Any]) -> str:
    """Function to add as a `pydantic` validator to a field.

    This function will be called when the field is being validated, and it will
    receive the value of the field, and the values of the model being validated.

    If the field `title` is not empty, then it will be returned as is. Otherwise,
    the value of the field `name` will be capitalized and returned.
    """
    if not v:
        # If `name` doesn't pass the regex validation, then `values` won't have it
        name = values.get("name")
        if name:
            # If `name` has a value, then capitalize it and return it as the `title`
            return name.capitalize()
    return v
Function to add as a `pydantic` validator to a field.

    This function will be called when the field is being validated, and it will
    receive the value of the field, and the values of the model being validated.

    If the field `title` is not empty, then it will be returned as is. Otherwise,
    the value of the field `name` will be capitalized and returned.
    
argilla-v1/src/argilla_v1/client/feedback/schemas/validators.py