baichuan.jinja 524 B

12345678910111213
  1. {{ (messages|selectattr('role', 'equalto', 'system')|list|last).content|trim if (messages|selectattr('role', 'equalto', 'system')|list) else '' }}
  2. {%- for message in messages -%}
  3. {%- if message['role'] == 'user' -%}
  4. {{- '<reserved_106>' + message['content'] -}}
  5. {%- elif message['role'] == 'assistant' -%}
  6. {{- '<reserved_107>' + message['content'] -}}
  7. {%- endif -%}
  8. {%- endfor -%}
  9. {%- if add_generation_prompt and messages[-1]['role'] != 'assistant' -%}
  10. {{- '<reserved_107>' -}}
  11. {% endif %}