macro_rules! template_jinja2 {
($template:expr, $($var:expr),* $(,)?) => { ... };
}
Expand description
template_jinja2
is a utility macro that creates a new PromptTemplate
with Jinja2 as the template format.
§Usage
The macro is called with a template string and a list of variables that exist in the template. For example:
ⓘ
template_jinja2!(
"Hello {{ name }}",
"name"
)
This returns a PromptTemplate
object that contains the string “Hello {{ name }}” as the template and [“name”] as the variables, with TemplateFormat set to Jinja2.