Upload W8A16-AutoRound/chat_template.jinja with huggingface_hub
Browse files
W8A16-AutoRound/chat_template.jinja
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- bos_token -}}{%- set system_prompt = "" -%}{%- set ns = namespace(system_prompt="you are a multi-turn tool calling capable ai") -%}{%- if messages[0]["role"] == "system" -%} {%- set ns.system_prompt = messages[0]["content"] -%} {%- set messages = messages[1:] -%}{%- endif -%}{%- if tools -%} {%- set ns.system_prompt = ns.system_prompt + ("
|
| 2 |
+
" if ns.system_prompt else "") + "List of tools: <|tool_list_start|>[" -%} {%- for tool in tools -%} {%- if tool is not string -%} {%- set tool = tool | tojson -%} {%- endif -%} {%- set ns.system_prompt = ns.system_prompt + tool -%} {%- if not loop.last -%} {%- set ns.system_prompt = ns.system_prompt + ", " -%} {%- endif -%} {%- endfor -%} {%- set ns.system_prompt = ns.system_prompt + "]<|tool_list_end|>" -%}{%- endif -%}{%- if ns.system_prompt -%} {{- "<|im_start|>system
|
| 3 |
+
" + ns.system_prompt + "<|im_end|>
|
| 4 |
+
" -}}{%- endif -%}{%- for message in messages -%} {{- "<|im_start|>" + message["role"] + "
|
| 5 |
+
" -}}{%- set content = message["content"] -%}{%- set has_tool_calls = message.get("tool_calls") -%}{%- if has_tool_calls -%}{%- for tc in message["tool_calls"] -%}{%- set tcf = tc.get("function", tc) -%}{{- "<|tool_call_start|>[" + tcf["name"] + "(" + tcf.get("arguments", "") + ")]<|tool_call_end|>" -}}{%- endfor -%}{%- endif -%}{%- if message["reasoning_content"] is defined and message["reasoning_content"] -%}{{- "<think>" + message["reasoning_content"] + "</think>" -}}{%- endif -%} {%- if content is not string -%} {%- if content -%} {%- set content = content | tojson -%} {%- else -%} {%- set content = "" -%} {%- endif -%} {%- endif -%} {%- if message["role"] == "tool" -%} {%- set content = "<|tool_response_start|>" + content + "<|tool_response_end|>" -%} {%- endif -%} {{- content + "<|im_end|>
|
| 6 |
+
" -}}{%- endfor -%}{%- if add_generation_prompt -%} {{- "<|im_start|>assistant
|
| 7 |
+
" -}}{%- endif -%}
|