Files
Apriel-15B-type6-e5-max-1e4…/chat_template.jinja
ModelHub XC f819a0bfb7 初始化项目,由ModelHub XC社区提供模型
Model: yufeng1/Apriel-15B-type6-e5-max-1e4-alpha0_75-2
Source: Original Platform
2026-05-25 09:26:16 +08:00

34 lines
3.5 KiB
Django/Jinja

{%- set available_tool_string, add_tool_id = '', true -%}{%- set reasoning_prompt='You are a thoughtful and systematic AI assistant built by ServiceNow Language Models (SLAM) lab. Before providing an answer, analyze the problem carefully and present your reasoning step by step. After explaining your thought process, provide the final solution in the following format: [BEGIN FINAL RESPONSE] ... [END FINAL RESPONSE].' -%}{%- set reasoning_asst_turn_start='Here are my reasoning steps:
' -%}{%- if tools is not none and tools|length > 0 -%} {%- set available_tools_string -%}You are provided with function signatures within <available_tools></available_tools> XML tags. You may call one or more functions to assist with the user query. Don't make assumptions about the arguments. You should infer the argument values from previous user responses and the system message. Here are the available tools: <available_tools>{% for tool in tools %}{{ tool|string }}{% endfor %}</available_tools>.
Return all function calls as a list of json objects within <tool_calls></tool_calls> XML tags. Each json object should contain a function name and arguments as follows: <tool_calls>[{"name": <function-name-1>, "arguments": <args-dict-1>}, {"name": <function-name-2>, "arguments": <args-dict-2>},...]</tool_calls> {%- endset -%}{%- endif -%}{%- if messages[0]['role'] != 'system' -%}{%- if tools is not none and tools|length > 0 -%} {{- '<|system|>
' + reasoning_prompt + '
' + available_tools_string + '
<|end|>
' -}} {%- else -%} {{- '<|system|>
' + reasoning_prompt + '
<|end|>
' -}} {%- endif -%}{%- endif -%}{%- for message in messages -%} {%- if message['role'] == 'user' -%} {{- '<|user|>
' + message['content'] + '
<|end|>
' -}} {%- elif message['role'] == 'system' -%} {%- if tools is not none and tools|length > 0 -%} {{- '<|system|>
' + reasoning_prompt + '
' + message['content'] + '
' + available_tools_string + '
<|end|>
' -}} {%- else -%} {{- '<|system|>
' + reasoning_prompt + '
' + message['content'] + '
<|end|>
' -}} {%- endif -%} {%- elif message['role'] == 'assistant' -%} {%- if loop.last -%} {%- set add_tool_id = false -%} {%- endif -%} {{- '<|assistant|>
' -}} {%- if message['content'] is not none -%} {{- message['content'] -}} {%- elif message['chosen'] is not none and message['chosen']|length > 0 -%} {{- message['chosen'][0] -}} {%- endif -%} {%- if message['tool_calls'] is not none and message['tool_calls']|length > 0 -%} {{- '
<tool_calls>[' -}} {%- for tool_call in message["tool_calls"] -%} {{- '{"name": "' + tool_call['function']['name'] + '", "arguments": ' + tool_call['function']['arguments']|string -}} {%- if add_tool_id == true -%} {{- ', "id": "' + tool_call['id'] -}} {%- endif -%} {{- '}' -}} {%- if not loop.last -%}{{- ', ' -}}{%- endif -%} {%- endfor -%} {{- ']</tool_calls>' -}} {%- endif -%} {%- if not loop.last or training_prompt -%} {{- '
<|end|>
' -}} {%- endif -%} {%- elif message['role'] == 'tool' -%} {{- '<|tool_result|>
' + message['content']|string + '
<|end|>
' -}} {%- endif -%} {%- if loop.last and add_generation_prompt and message['role'] != 'assistant' -%} {{- '<|assistant|>
' + reasoning_asst_turn_start -}} {%- endif -%}{%- endfor -%}