dhara-250m-OptiQ-8bit / chat_template.jinja
codelion's picture
dhara-250m OptIQ mixed-precision 4-bit (4.86 bpw, 148@4 + 76@8)
ef6e8ed verified
Raw
History Blame Contribute Delete
1.86 kB
{{- bos_token }}{%- if tools %}{{- '<|im_start|>system\n' }}{%- if messages[0].role == 'system' %}{{- messages[0].content + '\n\n' }}{%- endif %}{{- 'You are a function calling AI model. You are provided with function signatures within <tools></tools> XML tags. You may call one or more functions to assist with the user query. For each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tools>\n' }}{%- for tool in tools %}{{- (tool.function if tool.function is defined else tool) | tojson }}{{- '\n' }}{%- endfor %}{{- '</tools>\nFor each function call, return a json object like {"name": <function-name>, "arguments": <args-json-object>} wrapped in <tool_call></tool_call> tags.<|im_end|>\n' }}{%- elif messages[0].role == 'system' %}{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}{%- endif %}{%- for message in messages %}{%- if message.role == 'system' and loop.first %}{%- elif message.role == 'user' %}{{- '<|im_start|>user\n' + message.content + '<|im_end|>\n' }}{%- elif message.role == 'assistant' %}{{- '<|im_start|>assistant\n' }}{% generation %}{%- if message.content %}{{- message.content }}{%- endif %}{%- if message.tool_calls %}{%- for tc in message.tool_calls %}{%- if message.content or not loop.first %}{{- '\n' }}{%- endif %}{{- '<tool_call>\n{"name": "' + (tc.function.name) + '", "arguments": ' }}{%- if tc.function.arguments is string %}{{- tc.function.arguments }}{%- else %}{{- tc.function.arguments | tojson }}{%- endif %}{{- '}\n</tool_call>' }}{%- endfor %}{%- endif %}{{- '<|im_end|>' }}{% endgeneration %}{{- '\n' }}{%- elif message.role == 'tool' %}{{- '<|im_start|>tool\n<tool_response>\n' + message.content + '\n</tool_response><|im_end|>\n' }}{%- endif %}{%- endfor %}{%- if add_generation_prompt %}{{- '<|im_start|>assistant\n' }}{%- endif %}