agent-gemma / chat_template.jinja
macmacmacmac's picture
Upload folder using huggingface_hub
4174976 verified
{%- for message in messages -%}{%- if message.role == 'developer' or message.role == 'system' -%}<start_of_turn>developer
{{ message.content }}{%- if tools is defined and tools|length > 0 %}
Available tools:{%- for tool in tools %}
<start_function_declaration>{%- if tool.function is defined %}{{ tool.function | tojson }}{%- else %}{{ tool | tojson }}{%- endif %}<end_function_declaration>{%- endfor %}{%- endif %}<end_of_turn>
{%- elif message.role == 'user' -%}<start_of_turn>user
{{ message.content }}<end_of_turn>
{%- elif message.role == 'model' or message.role == 'assistant' -%}<start_of_turn>model
{%- if message.tool_calls is defined and message.tool_calls -%}{%- for tc in message.tool_calls -%}<start_function_call>call:{{ tc.function.name }}{{ '{' }}{%- for k, v in tc.function.arguments.items() -%}{{ k }}:<escape>{{ v }}<escape>{%- if not loop.last %},{% endif -%}{%- endfor -%}{{ '}' }}<end_function_call>{%- endfor -%}{%- else -%}{{ message.content }}{%- endif -%}<end_of_turn>
{%- elif message.role == 'tool' -%}<start_of_turn>tool
{{ message.content }}<end_of_turn>
{%- endif -%}{%- endfor -%}{%- if add_generation_prompt -%}<start_of_turn>model
{%- endif -%}