> ## Documentation Index
> Fetch the complete documentation index at: https://docs.volubile.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Templating

> Volubile allows the use of contextual variables to make prompts adaptable and relevant during conversations. This method transforms static prompts into intelligent instructions that respond to the specifics of each interaction, thanks to the use of Jinja templating.

## Fundamental Principles of Jinja

### Basic Structure

Jinja works by combining static text with dynamic elements delimited by specific syntaxes:

| Delimiter   | Function                | Example                                                    |
| ----------- | ----------------------- | ---------------------------------------------------------- |
| `{{ ... }}` | Variable Insertion      | `Hello {{ client.name }}`                                  |
| `{% ... %}` | Logical Instructions    | `{% if hour > 18 %}Good evening{% else %}Hello{% endif %}` |
| `{# ... #}` | Comments (not rendered) | `{# This text does not appear in the final prompt #}`      |

### Types of Variables

Variables can contain different types of data:

```jinja theme={null}
{# Simple Variables #}
{{ client_name }}         {# String #}
{{ client_age }}          {# Number #}
{{ is_premium }}          {# Boolean #}

{# Structured Variables #}
{{ client.address.city }}         {# Accessing nested properties #}
{{ client['address']['city'] }}   {# Accessing nested properties #}
{{ products[0].name }}            {# Accessing list items #}
```

### Conditions (if/elif/else)

Conditions allow for adapting the prompt according to different contexts:

```jinja theme={null}
{% if system.phone is defined %}
   Can you confirm that your number is {{ system.phone }}?
{% else %}
   Can you give me your number?
{% endif %}
```

<Tip> Use nested conditions to manage complex scenarios, but maintain a readable structure to facilitate maintenance. </Tip>

## Additional Resources

<Card title="Jinja Documentation" icon="text" href="https://jinja.palletsprojects.com/en/stable/" horizontal>
  For complete documentation on Jinja syntax, please refer to the documentation.
</Card>
