CoolFace
Modelpublic

melsmm/Spell-Corrector-RU-4B

sourceHugging Faceapache-2.0updated 4mo agoView on Hugging Face
3likes911downloads
chat_template.jinja53 linesDownload Raw Back to root
1{%- if tools %}2    {{- '<|im_start|>system\n' }}3    {%- if messages[0]['role'] == 'system' %}4        {{- messages[0]['content'] }}5    {%- else %}6        {{- 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.' }}7    {%- endif %}8    {{- "\n\n# 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>" }}9    {%- for tool in tools %}10        {{- "\n" }}11        {{- tool | tojson }}12    {%- endfor %}13    {{- "\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" }}14{%- else %}15    {%- if messages[0]['role'] == 'system' %}16        {{- '<|im_start|>system\n' + messages[0]['content'] + '<|im_end|>\n' }}17    {%- endif %}18{%- endif %}19{%- for message in messages %}20    {%- if (message.role == "user") or (message.role == "system" and not loop.first) or (message.role == "assistant" and not message.tool_calls) %}21        {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}22    {%- elif message.role == "assistant" %}23        {{- '<|im_start|>' + message.role }}24        {%- if message.content %}25            {{- '\n' + message.content }}26        {%- endif %}27        {%- for tool_call in message.tool_calls %}28            {%- if tool_call.function is defined %}29                {%- set tool_call = tool_call.function %}30            {%- endif %}31            {{- '\n<tool_call>\n{"name": "' }}32            {{- tool_call.name }}33            {{- '", "arguments": ' }}34            {{- tool_call.arguments | tojson }}35            {{- '}\n</tool_call>' }}36        {%- endfor %}37        {{- '<|im_end|>\n' }}38    {%- elif message.role == "tool" %}39        {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %}40            {{- '<|im_start|>user' }}41        {%- endif %}42        {{- '\n<tool_response>\n' }}43        {{- message.content }}44        {{- '\n</tool_response>' }}45        {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}46            {{- '<|im_end|>\n' }}47        {%- endif %}48    {%- endif %}49{%- endfor %}50{%- if add_generation_prompt %}51    {{- '<|im_start|>assistant\n' }}52{%- endif %}53