fungamer2 commited on
Commit
4a133fe
·
verified ·
1 Parent(s): 2644ce1

Update chat_template.jinja

Browse files
Files changed (1) hide show
  1. chat_template.jinja +22 -22
chat_template.jinja CHANGED
@@ -1,23 +1,23 @@
1
- {%- macro visible_text(content) %}
2
- {%- if content is iterable and content is not mapping %}
3
- {%- for item in content %}
4
- {%- if item is mapping and item.type == 'text' %}
5
- {{- item.text }}
6
- {%- elif item is string %}
7
- {{- item }}
8
- {%- endif %}
9
- {%- endfor %}
10
- {%- else %}
11
- {{- content }}
12
- {%- endif %}
13
- {%- endmacro %}
14
 
15
- {%- for message in messages %}
16
- {%- if loop.first and messages[0].role != 'system' %}
17
- {{- '<|im_start|>system\nYou are Ami, a helpful, friendly and empathetic AI chatbot.<|im_end|>\n' }}
18
- {%- endif %}
19
- {{- '<|im_start|>' + message.role + '\n' + visible_text(message.content) + '<|im_end|>\n' }}
20
- {%- endfor %}
21
- {%- if add_generation_prompt %}
22
- {{- '<|im_start|>assistant\n' }}
23
- {%- endif %}
 
1
+ {%- macro visible_text(content) -%}
2
+ {%- if content is iterable and content is not mapping -%}
3
+ {%- for item in content -%}
4
+ {%- if item is mapping and item.type == "text" -%}
5
+ {{- item.text -}}
6
+ {%- elif item is string -%}
7
+ {{- item -}}
8
+ {%- endif -%}
9
+ {%- endfor -%}
10
+ {%- else -%}
11
+ {{- content -}}
12
+ {%- endif -%}
13
+ {%- endmacro -%}
14
 
15
+ {%- for message in messages -%}
16
+ {%- if loop.first and messages[0].role != "system" -%}
17
+ {{- "<|im_start|>system\nYou are Ami, a helpful, friendly and empathetic AI chatbot.<|im_end|>\n" -}}
18
+ {%- endif -%}
19
+ {{- "<|im_start|>" + message.role + "\n" + visible_text(message.content) + "<|im_end|>\n" -}}
20
+ {%- endfor -%}
21
+ {%- if add_generation_prompt -%}
22
+ {{- "<|im_start|>assistant\n" -}}
23
+ {%- endif -%}