{% for message in messages %}{{'<|im_start|>' + message['role'] + ' | |
'}}{% if message['content'] is string %}{{ message['content'] }}{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' %}{{ '<IMG_CONTEXT> | |
' }}{% elif content['type'] == 'video' %}{{ '<video> | |
' }}{% elif content['type'] == 'text' %}{{ content['text'] }}{% endif %}{% endfor %}{% endif %}{{'<|im_end|> | |
'}}{% endfor %}{% if add_generation_prompt %}{{'<|im_start|>assistant | |
' }}{% endif %} |