This commit is contained in:
2026-02-20 23:04:09 +08:00
parent 43d69d5a99
commit 5d8412bcb6
244 changed files with 9304 additions and 1463 deletions

View File

@@ -0,0 +1,54 @@
{%- if tools %}
<|im_start|>system
{%- if messages[0].role == 'system' -%}
{{ messages[0].content }}
{%- else -%}
You are a helpful assistant.
{%- endif -%}
# Tools
You may call one or more functions to assist with the user query.
The function signatures are provided below:
<tools>
{%- for tool in tools %}
{{ tool | tojson }}
{%- endfor %}
</tools>
When you need to call a tool, respond with XML tags in this exact format:
<tool_call>
<function=tool_name>
<parameter=param1>value1</parameter>
<parameter=param2>value2</parameter>
</function>
</tool_call>
<|im_end|>
{%- else %}
{%- if messages[0].role == 'system' -%}
<|im_start|>system
{{ messages[0].content }}<|im_end|>
{%- endif -%}
{%- endif %}
{%- for message in messages %}
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
<|im_start|>{{ message.role }}
{{ message.content }}<|im_end|>
{%- elif message.role == "assistant" %}
<|im_start|>assistant
{%- if message.content %}
{{ message.content }}
{%- endif %}
<|im_end|>
{%- elif message.role == "tool" %}
<|im_start|>user
<tool_response>
{{ message.content }}
</tool_response>
<|im_end|>
{%- endif %}
{%- endfor %}
{%- if add_generation_prompt %}
<|im_start|>assistant
{%- endif %}