`"foo {variable2}"`.
        Returns:
            The prompt template loaded from the template.
        """
        if template_format == "jinja2":
            # Get the variables for the template
            input_variables = _get_jinja2_variables_from_template(template)
        elif template_format == "f-string":
            input_variables = {
                v for _, v, _, _ in Formatter().parse(template) if v is not None
            }
        else:
            raise ValueError(f"Unsupported template format: {template_format}")
        _partial_variables = partial_variables or {}
        if _partial_variables:
            input_variables = {
                var for var in input_variables if var not in _partial_variables
            }
        return cls(
            input_variables=sorted(input_variables),
            template=template,
            template_format=template_format,
            partial_variables=_partial_variables,
            **kwargs,
        )
# For backwards compatibility.
Prompt = PromptTemplate