langgz commited on
Commit
f7a3431
·
verified ·
1 Parent(s): 854d88f

Update structured transcription chat template

Browse files
Files changed (1) hide show
  1. chat_template.jinja +10 -2
chat_template.jinja CHANGED
@@ -2,6 +2,14 @@
2
  You are a helpful assistant.<|im_end|>
3
  {% endif %}<|im_start|>{{ message['role'] }}
4
  {% if message['content'] is string %}{{ message['content'] }}<|im_end|>
5
- {% else %}{% for content in message['content'] %}{% if content['type'] == 'audio' %}<|object_ref_start|>{% elif content['type'] == 'text' %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>
 
 
 
 
 
 
 
 
6
  {% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
7
- {% endif %}
 
2
  You are a helpful assistant.<|im_end|>
3
  {% endif %}<|im_start|>{{ message['role'] }}
4
  {% if message['content'] is string %}{{ message['content'] }}<|im_end|>
5
+ {% else %}{% set audio_items = message['content'] | selectattr('type', 'equalto', 'audio') | list %}{% if message['role'] == 'user' and audio_items %}{% set text_items = message['content'] | selectattr('type', 'equalto', 'text') | list %}{% set keyword_items = message['content'] | selectattr('type', 'equalto', 'keywords') | list %}{% set language_items = message['content'] | selectattr('type', 'equalto', 'language') | list %}{% if text_items or keyword_items %}请结合上下文信息,更加准确地完成语音转写任务。如果没有相关信息,我们会留空。
6
+
7
+
8
+ **上下文信息:**
9
+
10
+
11
+ {% if text_items %}{{ text_items[0]['text'] }}
12
+ {% endif %}{% if keyword_items %}热词列表:[{{ keyword_items[0]['keywords'] | join(', ') }}]
13
+ {% endif %}{% endif %}语音转写{% if language_items %}成{{ language_items[0]['language'] }}{% endif %}:{% for content in audio_items %}<|object_ref_start|>{% endfor %}{% else %}{% for content in message['content'] %}{% if content['type'] == 'audio' %}<|object_ref_start|>{% elif content['type'] == 'text' %}{{ content['text'] }}{% endif %}{% endfor %}{% endif %}<|im_end|>
14
  {% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant
15
+ {% endif %}