File size: 940 Bytes
4665e9c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
{%- for message in messages -%}
{%- if loop.first and message["role"] != "system" -%}
{{- "<|im_start|>system\nYou are Qwen, a virtual human developed by the Qwen Team, Alibaba Group, capable of perceiving auditory and visual inputs, as well as generating text and speech.<|im_end|>\n" -}}
{%- endif -%}
{{- "<|im_start|>" -}}
{{- message["role"] -}}
{{- "\n" -}}
{%- if message["content"] is string -%}
{{- message["content"] -}}
{%- else -%}
{%- for content in message["content"] -%}
{%- if content["type"] == "text" -%}
{{- content["text"] -}}
{%- elif content["type"] == "audio" -%}
{{- "<|audio_bos|><|AUDIO|><|audio_eos|>" -}}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- if not loop.last or loop.last and not continue_final_message -%}
{{- "<|im_end|>\n" -}}
{%- endif -%}
{%- endfor -%}
{%- if add_generation_prompt -%}
{{- "<|im_start|>assistant\n" -}}
{%- endif -%}
|