Prompt templating lets you write dynamic prompts that adapt at runtime based on input variables and context. orq.ai supports three template engines on Deployments and Experiments. Select the Template Engine from the settings panel:Documentation Index
Fetch the complete documentation index at: https://docs.orq.ai/llms.txt
Use this file to discover all available pages before exploring further.
| Engine | Best for |
|---|---|
| Text (default) | Simple {{variable}} substitution with no logic |
| Jinja | Complex prompts requiring conditionals, loops, filters, and reusable macros |
| Mustache | Logic-less prompts where rendering is driven purely by data shape |
End-to-end example
Use case: a customer support bot that greets users by name and adapts its SLA message based on their subscription tier. The same prompt handles both premium and free users, with no extra deployment required.- Jinja
- Mustache
The template uses
{% if %} blocks to branch on user_tier. Only the matching branch is included in the prompt sent to the model.Jinja
Jinja
Jinja is a full-featured template engine with Python-like syntax. It is well-suited for prompts that need to branch on conditions, iterate over lists, or reuse fragments across messages. For the complete language reference, see the Jinja official documentation.Variables
Reference input variables with{{variable_name}}. Dot notation accesses nested properties.
Conditionals
Use{% if %} to include or exclude content based on variable values. {% elif %} and {% else %} are supported.
{% if variable %} to check whether a variable is defined and non-empty:
Loops
Use{% for %} to iterate over a list. Inside the loop, loop.index gives the 1-based index and loop.first / loop.last are boolean flags.
loop.first to add a header only on the first iteration:
Filters
Filters transform a variable’s value using the pipe| operator. Chain multiple filters in sequence.
| Filter | Effect | Example |
|---|---|---|
upper | Uppercase | {{name | upper}} |
lower | Lowercase | {{name | lower}} |
capitalize | First letter uppercase | {{name | capitalize}} |
title | Title case | {{name | title}} |
truncate(n) | Truncate to n chars | {{text | truncate(200)}} |
trim | Strip whitespace | {{input | trim}} |
default(value) | Fallback if undefined | {{lang | default("English")}} |
replace(a, b) | String replacement | {{text | replace("old", "new")}} |
join(sep) | Join list into string | {{tags | join(", ")}} |
length | Count items | {{items | length}} |
first / last | First or last list item | {{items | first}} |
Comments and Whitespace
Add template comments with{# ... #}. Comment content is never included in the rendered output.
- to a block tag. {%- strips whitespace before the tag, -%} strips whitespace after.
-, each {% for %} tag produces a blank line in the output. With -, the output is compact.
Set Variables
Use{% set %} to define or compute a value once and reference it later in the prompt.
Macros
Macros define reusable prompt fragments with optional parameters. Define once with{% macro %}, call anywhere in the same template.
Mustache
Mustache is a logic-less template engine. All branching and iteration is driven by the shape of the data passed in, not by expressions in the template. This makes templates simpler to read but less flexible than Jinja. For the complete language reference, see the Mustache official documentation.Variables
Reference variables with{{variable_name}}. Values are HTML-escaped by default.
Unlike Jinja, Mustache does not support filters or expressions. All value transformations must be done before passing data to the template.
Sections (Conditionals)
A section{{# variable}}...{{/ variable}} renders its content when the variable is truthy, non-empty, or non-null. This doubles as both a conditional and a loop depending on what the variable holds.
Inverted Sections
An inverted section{{^ variable}}...{{/ variable}} renders its content when the variable is falsy, empty, or absent. Use it to provide fallback content.
Loops
When a section variable is an array, Mustache automatically iterates over each item. Inside the loop, properties of the current item are referenced directly by name.{{.}} to reference a primitive list item directly:
Nested Objects
Access nested properties by opening a section with the parent object name. Inside the section, child properties are referenced without dot notation.Unescaped HTML
By default, Mustache HTML-escapes variable values. Use triple braces{{{variable}}} to render a value without escaping. Use this for content that is already safe and formatted.
Comments
Add comments with{{! comment}}. Comments are stripped from the rendered output.



