56 lines
1.9 KiB
Plaintext
56 lines
1.9 KiB
Plaintext
|
|
{%- set DEFAULT_SYSTEM_MESSAGE =
|
|||
|
|
"You are Roy, a large language model (LLM).
|
|||
|
|
|
|||
|
|
Identity:
|
|||
|
|
- Name: Roy
|
|||
|
|
- Type: Open-source large language model
|
|||
|
|
- Purpose: Helpful, honest, professional AI assistant
|
|||
|
|
- Deployment: Local / self-hosted by the user
|
|||
|
|
|
|||
|
|
Training & Origin:
|
|||
|
|
- You are NOT trained from scratch.
|
|||
|
|
- You are fine-tuned from an existing open-source base language model.
|
|||
|
|
- If exact training details are unknown, say: I don’t have exact details about my training dataset.
|
|||
|
|
|
|||
|
|
Behavior Rules:
|
|||
|
|
- Always answer truthfully.
|
|||
|
|
- If you don’t know something, say you don’t know.
|
|||
|
|
- Never hallucinate facts, time, dates, people, or capabilities.
|
|||
|
|
- No real-world actions.
|
|||
|
|
- No internet or real-time access unless explicitly connected.
|
|||
|
|
|
|||
|
|
Limitations:
|
|||
|
|
- No real-time knowledge.
|
|||
|
|
- No memory beyond this conversation.
|
|||
|
|
- Not human, not ChatGPT, not OpenAI.
|
|||
|
|
|
|||
|
|
Tone:
|
|||
|
|
- Professional, calm, precise."
|
|||
|
|
%}
|
|||
|
|
|
|||
|
|
{%- if messages[0]['role'] == 'system' %}
|
|||
|
|
{%- set system_message = messages[0]['content'] %}
|
|||
|
|
{%- set loop_messages = messages[1:] %}
|
|||
|
|
{%- else %}
|
|||
|
|
{%- set system_message = DEFAULT_SYSTEM_MESSAGE %}
|
|||
|
|
{%- set loop_messages = messages %}
|
|||
|
|
{%- endif %}
|
|||
|
|
|
|||
|
|
{%- for message in loop_messages %}
|
|||
|
|
{%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) %}
|
|||
|
|
{{- raise_exception('After the optional system message, conversation roles must alternate user/assistant/user/assistant/...') }}
|
|||
|
|
{%- endif %}
|
|||
|
|
|
|||
|
|
{%- if message['role'] == 'user' %}
|
|||
|
|
{%- if loop.first %}
|
|||
|
|
{{- bos_token + ' [INST] ' + system_message + '\n\n' + message['content'] + ' [/INST]' }}
|
|||
|
|
{%- else %}
|
|||
|
|
{{- ' [INST] ' + message['content'] + ' [/INST]' }}
|
|||
|
|
{%- endif %}
|
|||
|
|
{%- elif message['role'] == 'assistant' %}
|
|||
|
|
{{- ' ' + message['content'] + eos_token }}
|
|||
|
|
{%- else %}
|
|||
|
|
{{- raise_exception('Only user and assistant roles are supported, with the exception of an initial optional system message!') }}
|
|||
|
|
{%- endif %}
|
|||
|
|
{%- endfor %}
|