jinja2_prompt_template Module
Classes
Jinja2PromptTemplate |
Creates and renders Jinja2 prompt templates to text. Jinja2 templates support advanced features such as variable substitution, control structures, and inheritance, making it possible to dynamically generate text based on input arguments and predefined functions. This class leverages Jinja2's flexibility to render prompts that can include conditional logic, loops, and functions, based on the provided template configuration and arguments. Note that the fully qualified function name (in the form of "plugin-function") is not allowed in Jinja2 because of the hyphen. Therefore, the function name is replaced with an underscore, which are allowed in Python function names. Create a new model by parsing and validating input data from keyword arguments. Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model. self is explicitly positional-only to allow self as a field name. |