j2prompt-lint/jinja2-prompt-template-corpus huggingface dataset:
{%- set has_system = messages|selectattr('role', 'equalto', 'system')|list|length > 0 -%}{%- if not has_system -%}{{- '
system
You are Olmo, a helpful AI assistant built by Ai2. Your date cutoff is December 2024, and your model weights are available at https://huggingface.co/allenai. ' -}}{%- if tools is none or (tools | length) == 0 -%}{{- 'You do not currently have access to any functions. <functions></functions>

' -}}{%- else -%}{{- 'You are provided with function signatures within <functions></functions> XML tags. You may call one or more functions to assist with the user query. Output any function calls within <function_calls></function_calls> XML tags. Do not make assumptions about what values to plug into functions.' -}}{{- '<functions>' -}}{{- tools | tojson -}}{{- '</functions>

' -}}{%- endif -%}{%- endif -%}{%- for message in messages -%}{%- if message['role'] == 'system' -%}{{- '
system
' + message['content'] -}}{%- if tools is not none -%}{{- '<functions>' -}}{{- tools | tojson -}}{{- '</functions>' -}}{%- elif message.get('functions', none) is not none -%}{{- ' <functions>' + message['functions'] + '</functions>' -}}{%- endif -%}{{- '

' -}}{%- elif message['role'] == 'user' -%}{{- '
user
' + message['content'] + '

' -}}{%- elif message['role'] == 'assistant' -%}{{- '
assistant
' -}}{%- if message.get('content', none) is not none -%}{{- message['content'] -}}{%- endif -%}{%- if message.get('function_calls', none) is not none -%}{{- '<function_calls>' + message['function_calls'] + '</function_calls>' -}}{% elif message.get('tool_calls', none) is not none %}{{- '<function_calls>' -}}{%- for tool_call in message['tool_calls'] %}{%- if tool_call is mapping and tool_call.get('function', none) is not none %}{%- set args = tool_call['function']['arguments'] -%}{%- set ns = namespace(arguments_list=[]) -%}{%- for key, value in args.items() -%}{%- set ns.arguments_list = ns.arguments_list + [key ~ '=' ~ (value | tojson)] -%}{%- endfor -%}{%- set arguments = ns.arguments_list | join(', ') -%}{{- tool_call['function']['name'] + '(' + arguments + ')' -}}{%- if not loop.last -%}{{ '
' }}{%- endif -%}{% else %}{{- tool_call -}}{%- endif %}{%- endfor %}{{- '</function_calls>' -}}{%- endif -%}{%- if not loop.last -%}{{- '
' + '
' -}}{%- else -%}{{- eos_token -}}{%- endif -%}{%- elif message['role'] == 'environment' -%}{{- '
environment
' + message['content'] + '

' -}}{%- elif message['role'] == 'tool' -%}{{- '
environment
' + message['content'] + '

' -}}{%- endif -%}{%- if loop.last and add_generation_prompt -%}{{- '
assistant\n' -}}{%- endif -%}{%- endfor -%}
{%- set identifier = 'im' %}
{% for message in messages %}
    {% if add_system_prompt and loop.first and message['role'] != 'system' %}
        {{- '
system
You are VideoLLaMA3 created by Alibaba DAMO Academy, a helpful assistant to help people understand images and videos.

' -}}
    {% endif %}
    {% if message['role'] == 'stream' %}
        {% set identifier = 'stream' %}
    {% else %}
        {% set identifier = 'im' %}
    {% endif %}
    {{- '<|' + identifier + '_start|>' + message['role'] + '
' -}}
    {% if message['content'] is string %}
        {{- message['content'] + '<|' + identifier + '_end|>
' -}}
    {% else %}
        {% for content in message['content'] %}
            {% if content is string %}
                {{- content -}}
            {% elif content['type'] == 'text' or 'text' in content %}
                {{- content['text'] -}}
            {% elif content['type'] == 'image' or 'image' in content %}
                {% if 'timestamp' in content %}
                    {{- 'Time ' + content['timestamp'] | round(1) | string + 's: ' -}}
                {% endif %}
                {{- image_token + '
' -}}
            {% elif content['type'] == 'video' or 'video' in content %}
                {% for i in range(content['num_frames']) %}
                    {% if 'timestamps' in content %}
                        {{- 'Time ' + content['timestamps'][i] | round(1) | string + 's:' -}}
                    {% endif %}
                    {% if i < content['num_frames'] - 1 %}
                        {{- image_token + ',' -}}
                    {% else %}
                        {{- image_token + '
' -}}
                    {% endif %}
                {% endfor %}
            {% endif %}
        {% endfor %}
        {% if identifier == 'stream' %}
            {{- '<|' + identifier + '_end|>' -}}
        {% else %}
            {{- '<|' + identifier + '_end|>
' -}}
        {% endif %}
    {% endif %}
{% endfor %}
{% if add_generation_prompt %}
    {{- '
assistant
' -}}
{% endif %}