falcon.jinja 471 B

123456789101112131415
  1. {%- for message in messages -%}
  2. {%- if message['role'] == 'user' -%}
  3. {{- 'User: ' + message['content'] -}}
  4. {%- elif message['role'] == 'assistant' -%}
  5. {{- 'Assistant: ' + message['content'] -}}
  6. {%- endif -%}
  7. {%- if (loop.last and add_generation_prompt) or not loop.last -%}
  8. {{- '\n' -}}
  9. {%- endif -%}
  10. {%- endfor -%}
  11. {%- if add_generation_prompt and messages[-1]['role'] != 'assistant' -%}
  12. {{- 'Assistant:' -}}
  13. {% endif %}