Download chat_template.jinja from CrowdMind/lamb: direct link, hf CLI and curl.
- Browser
- Download file 1.62 kB
-
https://huggingface.co/CrowdMind/lamb/resolve/main/chat_template.jinja
- Command line
-
hf download hf://CrowdMind/lamb/chat_template.jinja
-
curl -L -o chat_template.jinja https://huggingface.co/CrowdMind/lamb/resolve/main/chat_template.jinja
1.62 kB
| {# | |
| Harness-neutral nanochat chat template. | |
| Training adapters normalize tool turns into assistant content parts: | |
| text, tool_call (JSON text), and tool_output (JSON text). The call JSON keeps | |
| the source call ID, tool name, and arguments; the tool menu comes from `tools`. | |
| <|bos|> is added by the tokenizer and must not be emitted here. | |
| #} | |
| {%- set system = messages[0]['content'] if messages and messages[0]['role'] == 'system' else '' -%} | |
| {%- set ns = namespace(first_user=true) -%} | |
| {%- for message in messages -%} | |
| {%- if message['role'] == 'user' -%} | |
| {{ '<|user_start|>' }}{%- if ns.first_user and tools %}<tool_schemas>{{ tools|tojson }}</tool_schemas>{{ '\n\n' }}{%- endif -%}{%- if ns.first_user and system %}{{ system + '\n\n' }}{%- endif -%}{{ message['content'] }}{{ '<|user_end|>' }}{%- set ns.first_user = false -%} | |
| {%- elif message['role'] == 'assistant' -%} | |
| {{ '<|assistant_start|>' }}{%- if message['content'] is string -%}{{ message['content'] }}{%- else -%}{%- for part in message['content'] -%}{%- if part['type'] == 'text' -%}{{ part['text'] }}{%- elif part['type'] == 'python' -%}{{ '<|python_start|>' + part['text'] + '<|python_end|>' }}{%- elif part['type'] == 'python_output' -%}{{ '<|output_start|>' + part['text'] + '<|output_end|>' }}{%- elif part['type'] == 'tool_call' -%}{{ '<tool_call>' + part['text'] + '</tool_call>' }}{%- elif part['type'] == 'tool_output' -%}{{ '<|output_start|>' + part['text'] + '<|output_end|>' }}{%- endif -%}{%- endfor -%}{%- endif -%}{{ '<|assistant_end|>' }} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- if add_generation_prompt -%}{{ '<|assistant_start|>' }}{%- endif -%} | |