ReByte
Search
K

Prompt Template Language

The Prompt Template Language is a simple language that allows you to create a prompt template that can be used to generate prompts for your LLM models. The Prompt Template Language is a subset of the Jinja templating language. Here are some examples of how you can use the Prompt Template Language, for more information on the syntax, see the Jinja documentation.
{{ and }} for expressions
{{ 1 + 1 }}
For referencing variables
{{ variable_name }}
for statements
{% for i in range(10) %}
{{ i }}
{% endfor %}
{# and #} for comments To comment out part of the template, wrap it in {# #}. Anything in between those tags will not be rendered.
{# This is a comment #}
Construct and attributes can be accessed by using the dot (.) like {{ product.name }}. Specific members of an array or tuple are accessed by using the .i notation, where i is a zero-based index. In dot notation variable can not be used after the dot (.).
{{ product.name }}
{{ product[0] }}
Tests can be used against an expression to check some condition on it and are made in if blocks using the is keyword. For example, you would write the following to test if an expression is odd:
{% if number is odd %}
This is an odd number
{% endif %}
Tests can also be negated:
{% if number is not odd %}
This is not an odd number
{% endif %}