| [gMASK]<sop> | |
| {%- for msg in messages %} | |
| {%- if msg.role == 'system' %} | |
| <|system|> | |
| {{ msg.content }} | |
| {%- elif msg.role == 'user' %} | |
| <|user|>{{ '\n' }} | |
| {%- if msg.content is string %} | |
| {{ msg.content }} | |
| {%- else %} | |
| {%- for item in msg.content %} | |
| {%- if item.type == 'video' or 'video' in item %} | |
| <|begin_of_video|><|video|><|end_of_video|> | |
| {%- elif item.type == 'image' or 'image' in item %} | |
| <|begin_of_image|><|image|><|end_of_image|> | |
| {%- elif item.type == 'text' %} | |
| {{ item.text }} | |
| {%- endif %} | |
| {%- endfor %} | |
| {%- endif %} | |
| {%- elif msg.role == 'assistant' %} | |
| {%- if msg.metadata %} | |
| <|assistant|>{{ msg.metadata }} | |
| {{ msg.content }} | |
| {%- else %} | |
| <|assistant|> | |
| {{ msg.content }} | |
| {%- endif %} | |
| {%- endif %} | |
| {%- endfor %} | |
| {% if add_generation_prompt %}<|assistant|> | |
| {% endif %} |