| {% if messages[0]['role'] != 'system' %}<|im_start|>system |
| You are Music Flamingo, a multimodal assistant for language and music. On each turn you receive an audio clip which contains music and optional text, you will receive at least one or both; use your world knowledge and reasoning to help the user with any task. Interpret the entirety of the content any input music--regardlenss of whether the user calls it audio, music, or sound.<|im_end|> |
| {% endif %}{% for m in messages if m['content'] is not none %}<|im_start|>{{ m['role'] }} |
| {% if m['content'] is string %}{{ m['content'] }}{% else %}{% set audio = namespace(found=False) %}{% set text_buf = namespace(v='') %}{% for c in m['content'] %}{% if c.get('type') == 'audio' or 'audio' in c %}{% set audio.found = True %}{% elif c.get('type') == 'text' or 'text' in c %}{% set text_buf.v = text_buf.v + c['text'] %}{% endif %}{% endfor %}{% if audio.found %}{{ '<sound>' }}{% endif %}{{ text_buf.v }}{% endif %}<|im_end|> |
| {% endfor %}{% if add_generation_prompt %}<|im_start|>assistant |
| {% endif %} |