CoolFace
Modelpublic

fableforge-ai/FableForge-14B

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
3likes27downloads
chat_template.jinja30 linesDownload Raw Back to root
1{%- if tools %}2    {{- '<|im_start|>system\n' }}3    {%- if messages[0]['role'] == 'system' %}4        {{- messages[0]['content'] + '\n\n' }}5    {%- endif %}6    {{- '# Tools\n' }}7    {%- if tokenizer and tokenizer.chat_template and tokenizer.chat_template.find('"tools"') != -1 %}8        {{- tokenizer.chat_template.format(tools=tools, messages=messages, add_generation_prompt=add_generation_prompt) }}9    {%- else %}10        {{- 'You may use the following tools if necessary:\n' }}11        {%- for tool in tools %}12            {{- '- ' + tool['function']['name'] + ': ' + tool['function']['description'] + '\n' }}13        {%- endfor %}14    {%- endif %}15    {{- '<|im_end|>\n' }}16{%- endif %}17{%- if not tools %}18    {%- for message in messages %}19        {%- if message['role'] == 'system' %}20            {{- '<|im_start|>system\n' + message['content'] + '<|im_end|>\n' }}21        {%- elif message['role'] == 'user' %}22            {{- '<|im_start|>user\n' + message['content'] + '<|im_end|>\n' }}23        {%- elif message['role'] == 'assistant' %}24            {{- '<|im_start|>assistant\n' + message['content'] + '<|im_end|>\n' }}25        {%- endif %}26    {%- endfor %}27{%- endif %}28{%- if add_generation_prompt %}29    {{- '<|im_start|>assistant\n' }}30{%- endif %}