CoolFace
Modelpublic

arcee-ai/Trinity-Mini-Base

sourceHugging Faceotherupdated 4mo agoView on Hugging Face
22likes318downloads
chat_template.jinja65 linesDownload Raw Back to root
1{%- if tools %}2    {{- '<|im_start|>system\n' }}3    {%- if messages[0].role == 'system' %}4        {{- messages[0].content + '\n\n' }}5    {%- endif %}6    {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}7    {%- for tool in tools %}8        {{- "\n" }}9        {{- tool | tojson }}10    {%- endfor %}11    {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}12{%- else %}13    {%- if messages[0].role == 'system' %}14        {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}15    {%- endif %}16{%- endif %}17{%- for message in messages %}18    {%- if message.content is string %}19        {%- set content = message.content %}20    {%- else %}21        {%- set content = '' %}22    {%- endif %}23    {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}24        {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}25    {%- elif message.role == "assistant" %}26        {{- '<|im_start|>' + message.role + '\n' }}27        {% generation %}28        {{- content}}29        {%- if message.tool_calls %}30            {%- for tool_call in message.tool_calls %}31                {%- if (loop.first and content) or (not loop.first) %}32                    {{- '\n' }}33                {%- endif %}34                {%- if tool_call.function %}35                    {%- set tool_call = tool_call.function %}36                {%- endif %}37                {{- '<tool_call>\n{"name": "' }}38                {{- tool_call.name }}39                {{- '", "arguments": ' }}40                {%- if tool_call.arguments is string %}41                    {{- tool_call.arguments }}42                {%- else %}43                    {{- tool_call.arguments | tojson }}44                {%- endif %}45                {{- '}\n</tool_call>' }}46            {%- endfor %}47        {%- endif %}48        {{- '<|im_end|>' }}49        {% endgeneration%}50        {{- '\n' }}51    {%- elif message.role == "tool" %}52        {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}53            {{- '<|im_start|>user' }}54        {%- endif %}55        {{- '\n<tool_response>\n' }}56        {{- content }}57        {{- '\n</tool_response>' }}58        {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}59            {{- '<|im_end|>\n' }}60        {%- endif %}61    {%- endif %}62{%- endfor %}63{%- if add_generation_prompt %}64    {{- '<|im_start|>assistant\n' }}65{%- endif %}