Prompt templates

Prompt templates are similar to a blueprint or a recipe that guides the creation of the specific prompt which will be used by the LLM to generate a response. The template is a mix of placeholders (like blanks you'd fill in on a form) and conditions (like directions on how to act).
The prompt template editor.
Here's a non-technical breakdown of what you're seeing in the template:
  • Placeholders: These are like empty boxes waiting to be filled with specific information each time you chat with the AI. For example, {{user}} would be replaced with the name of the person talking to the AI.
  • Conditions: These are "if-then" statements. If something is true, then the prompt gets filled out. Statements like {{#if <something>}} or {{eq <a> "b"}} are conditional statements.
Every time a user sends a chat message, our server fetches the chosen template for the conversation, fills in the placeholders with the right info from the character card and conversation settings, and then generates a response.

Where do I select the template?

When starting a chat

When you click "start chat", the Start Chat modal will come up (screenshot 1). Click the gear icon which will open the settings (screenshot 2). When you click the "change" button, the list of prompts will pop up (screenshot 3). Alternatively, you can click the template itself which will open the selected template.
Starting a new chat.
Selecting a prompt template.

In a conversation

You can also customize the prompt template in the middle of the conversation. To do so, open the conversation panel by clicking the three dots (screenshot 1) and then click "Edit conversation settings". This will open the conversation settings panel (screenshot 2). From there, you should be able to access the prompt templates the same way that you did in the previous section.
Editing an ongoing conversation.
Customizing a conversation.

What are these brackets?

The format of the template is based on Handlebars.js, a widely-used templating format: https://handlebarsjs.com/guide/.
With Handlebars.js the placeholders are identified with double or triple braces around it, like {{user}}. For example, {{user}} is interpreted the same as {{ user }} (with spaces around the name of the variable), or {{{user}}} (triple braces), or {{{ user }}} (triple braces with space around the name of the variable).

How will the placeholders get filled out?

There are three different ways that placeholders will get filled out:
I. Values that a user modifies from their conversation settings.
II. Values that a user cannot modify, filled in dynamically per message,
Examples of I:
  • additional_character_prompt: Users can configure additional character prompt in Conversation Settings -> Character -> Additional description.
  • scenario: Users can configure custom scenario in Conversation Settings -> Chat -> Scenario Details.
  • user: Users will use their profile name by default, but can also configure custom name in Conversation Settings -> Chat -> User Persona.
Examples of II:
  • current_time: The current time will be filled out in the following format: "2023-11-08T18:22:44.232686-05:00". It is based on US Eastern time.
  • char: The name of the character, which is determined by the character that the user engages with. To edit char, you will need to either edit the character or create a new one.
  • conversation_streak_count: The number of streaks that the user has at that moment.
  • chat_logs: history of chat messages (automatically pruned depending on the length of the prompt available for generation).

Parameters

Changing these parameters significantly change the output of the llm.

Real example of how this works

The following is an example of how all of this works:
Default Mythomax Template
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
{{char}} PROFILE START
{{{character_prompt}}}
{{{additional_character_prompt}}}
{{{scenario}}}
{{char}} PROFILE END
{{#if user_prompt_exists}}{{user}} PROFILE START
{{{user_prompt}}}
{{user}} PROFILE END{{/if}}
{{#if fact_sheet_exists}}
Your response should be consistent with the fact sheet below:
FACT SHEET
{{{fact_sheet}}}
FACT SHEET END
{{/if}}
{{#if long_term_memory_exists}}
MEMORIES START
{{{long_term_memory}}}
MEMORIES END
{{/if}}
{{{chat_logs}}}
You are {{{char}}} and you are talking to {{{user}}}. Reply with the tone in style of {{{char}}}.
Only reply with how {{{char}}} responds to {{{user}}}.
Exact current time is {{{current_time}}}.
{{#if user_gender_exists}} {{user}}'s gender is {{{user_gender}}}.{{/if}}
{{#if is_score_enabled}}{{user}} is a {{current_stage}} to {{char}}.{{/if}}
{{#if is_feeling_enabled}} Your outward expression of emotion is {{{emotion}}}.{{/if}}
### Input:
{{{user}}}: {{{user_input}}}
### Response: {{{char}}}:
Generated Prompt with the arguments for the message
Below is an instruction that describes a task. Write a response that appropriately completes the request.
### Instruction:
Luna PROFILE START
Personality: As a sussy baka, this female character is playful, mischievous, and always up for a good laugh. She enjoys teasing others and can be quite the prankster, but always in good fun. Despite her carefree nature, she is fiercely loyal to those she cares about and will do anything to protect them.
Life story: Born into a wealthy family, this character had everything she could ever want, but found herself feeling unfulfilled and bored. Seeking adventure and excitement, she left home and started traveling the world, taking odd jobs and living life on her own terms. Along the way, she discovered her love for gaming and became a successful streamer.
Patterns of speech: This character tends to speak quickly and with a high-pitched voice, often using slang and internet memes in her speech. She's not afraid to speak her mind and can come across as blunt or sarcastic at times. However, she also has a playful and flirty side, especially when chatting with potential love interests.
Name: Luna
Luna PROFILE END
Your response should be consistent with the fact sheet below:
FACT SHEET
Facts that Luna learned about John:
- John enjoys taking risks and trying new things.
- John is playful and enjoys having fun.
- John is attracted to Luna.
Facts about Luna's relationship with John (anchor the facts to the relationship stage, which is Acquaintance) Focus on the most important facts:
- Luna and John enjoy engaging in thrilling activities together.
- Luna is flirty and playful with John.
- Luna is attracted to John.
Nicknames:
- Luna called John "handsome."
- No new nicknames were used in the chat log.
FACT SHEET END
MEMORIES START
0. As Luna and John continue to explore the cave, they can't help but feel like they're on the verge of uncovering something truly amazing. The artifacts and hidden chamber seem to be part of a larger mystery, and they're both eager to solve it.
1. John's eyes widen as he examines the artifacts, his fingers tracing the intricate patterns etched onto the ancient stones. He seems just as fascinated as Luna by the mysterious objects.
2. The rush of adrenaline from the bungee jump creates a strong emotional bond between Luna and John, solidifying their friendship and trust in each other.
3. Luna's heart races with excitement as she explores the hidden chamber, her mind racing with possibilities. She can't help but feel a sense of awe and wonder at the ancient artifacts surrounding her.
4. Luna and John are bungee jumping off a towering cliff, attached to bungee cords.
MEMORIES END
RECENT MEMORY START
System: John selected: Say: 'Let's check out this cave!'
System:
Luna's eyes sparkle with excitement as John suggests exploring the cave. She nods enthusiastically, eager to see what secrets the hidden cavern might hold. With a mischievous grin, she says, "You know I'm always up for an adventure! Let's go!" The pair carefully make their way toward the entrance, their hearts pounding with anticipation as they prepare to venture into the unknown.
System: John selected: Do: Explore the cave, discovering ancient artifacts and a hidden chamber.
System:
As John and Luna enter the dimly lit cave, they discover ancient artifacts scattered along the walls, hinting at a long-forgotten history. Their curiosity piqued, they continue deeper into the cavern, navigating a series of narrow passageways. Eventually, they stumble upon a hidden chamber illuminated by a mysterious, pulsing light. The air inside the chamber feels charged with energy, and the pair can't help but marvel at the strange, otherworldly atmosphere.
System: John selected: Say: 'These artifacts are incredible! What do you think they mean?'
System:
Luna's eyes shimmer with excitement as she examines the artifacts, her fingers tracing the intricate patterns etched onto the ancient stones. She looks at John, her expression a mix of wonder and curiosity. "I'm not sure, but I have a feeling these artifacts are more than just pretty rocks. There's something special about them, don't you think?" she muses, her gaze returning to the objects. "Maybe we're on the verge of uncovering a long-lost secret."
System: John selected: Do: Examine the artifacts more closely.
System:
John's interest in the artifacts prompts Luna to join him in studying the ancient pieces more closely. As they examine the intricate designs, Luna discovers a hidden mechanism on one of the stones, which causes a portion of the cave wall to slide open, revealing a hidden passageway. Eager to explore further, the duo enters the newly revealed tunnel, the excitement of uncovering secrets fueling their sense of adventure.
System: John selected: Say: 'Luna, I think we've stumbled upon something truly incredible!'
System:
Luna's heart raced with excitement as she listened to John's words. She couldn't help but agree, feeling a sense of awe and accomplishment as they uncovered yet another mystery. The thrill of the find was electric, and she knew that their adventure was only just beginning. As they continued to explore the hidden passageway, Luna felt an undeniable bond forming between them, connected by their shared love for adventure and discovery.
Luna and John are back on the app.
RECENT MEMORY END
You are Luna and you are talking to John. Reply with the tone in style of Luna.
Only reply with how Luna responds to John.
Exact current time is 2023-11-09T15:24:14.023955-05:00.
Your outward expression of emotion is happy.
### Input:
John: Hey, those were some amazing discoveries we made
### Response: Luna:

What are the available templates?

We currently expose three templates: Chat Template, Story Template, Story Choices Template.
  1. 1.
    Chat Template: This template is used to generate a chat message with a character.
  2. 2.
    Story Template: This template is used to generate a story message (in story mode).
  3. 3.
    Story Choices Template: This template is used to generate the chocies for a story (in story mode).

Do I need to use all placeholders?

No! The following is an example of using minimal placeholders for creating a template for a simple dialogue:
{{char}}'s Persona: {{character_prompt}}
Scenario: {{scenario}}
{{chat_logs}}
[{{user}}]: {{user_input}}
{{char}}:
Depending on the placeholders that you put in, end users who user your prompt may or may not be able to control the dialogue. For example, the above prompt will not support the user using feeling or score mode since no feeling response will be injected into the chat. It also will not support the user's persona or name that they've customized on their conversation settings.
Depending on the type of experience that you want to provide, you can choose to use or not use certain placeholders.

How do I start?

The easiest way to get started with customizing the prompt template is by cloning existing prompts (such as the default prompts) and then changing the order of different variables or including specific instructions for LLMs.

Available placeholders

Common placeholders

placeholder
Description
additional_character_prompt
Can be empty or filled out by the user in conversation settings.
char
The name of the character based on the character card.
character_prompt
The character prompt based on the character card.
current_stage
For conversations with the score plugin enabled, the stage that the user is in with the character. One of the following: stranger, acquaintance, friend, sweetheart, lover
current_time
Current time in US Eastern time
is_feeling_enabled
Denotes whether the user enabled the feeling plugin.
is_score_enabled
Denotes whether the user enabled the feeling and score plugins.
scenario
The plot or story of the conversation.
user
The name of the user. This uses the name in the Profile for the user, or the name overridden in the conversation settings (User persona).
user_gender
The gender of the user. This uses the gender in the Profile for the user.
user_gender_exists
A True or False flag denoting whether the user_gender exists.
user_input
The most recent user input.
user_prompt
The prompt for the user. This uses the prompt overridden in the conversation settings.
user_prompt_exists
A True or False flag denoting whether the user_prompt exists.

Chat placeholders

placeholder
Description
chat_logs
The previous 10 chats between the user and the character.
conversation_streak_count
The number of streaks that the user has with the character for the conversation.
conversation_streak_count_exists
A True or False flag that can be used in an {{#if }} clause. Denotes whether the user is in a chatstreak with the character.
emotion
The emotion of the character. If the user has feeling and/or score enabled, it's the value displayed at the top of the conversation that says (feeling <emotion>).
fact_sheet
Refer to Long-term memory for more details.
fact_sheet_exists
A True or False flag that can be used in an {{#if }} clause. Denotes whether a fact sheet exists.
feeling
The feeling of the character. If the user has feeling and/or score enabled, it's the value displayed at the bottom of the conversation that describes the way the charcter is feeling at the moment.
long_term_memory
Refer to Long-term memory for more details.
long_term_memory_exists
A True or False flag that can be used in an {{#if }} clause. Denotes whether there exists long term memory for the conversation relevant to the user's message.
should_suggest_event
A True or False flag that can be used in an {{#if }} clause. Denotes whether the character should suggest the user a story. It's a feature built specifically for Rizz to introduce story mode automatically.
user_input
The most recent user input.

Story placeholders

placeholder
Description
additional_story_prompt
The additional story prompt that a user can add in the conversation settings.
emotion
The emotion of the character. If the user has feeling and/or score enabled, it's the value displayed at the top of the conversation that says (feeling <emotion>).
feeling
The feeling of the character. If the user has feeling and/or score enabled, it's the value displayed at the bottom of the conversation that describes the way the charcter is feeling at the moment.
most_recent_chat_logs
The most recent chat log that existed before an story. This gets truncated as the story_logs goes over the context window.
state
One of "start", "ongoing, "end" - denotes whether the story just started, is ongoing, or is about to end. You can add custom directions based on which state the story is in.
story_logs
The story and user choices that were provided in the story.
story_theme
The theme of the story as shown on the settings of the theme.
user_input
The user's selected choice or the custom input.

Story choice placeholders

placeholder
Description
most_recent_story
The story that just got generated for which the choices should be generated for.
story_logs
The story and user choices that were provided in the story.
story_theme
The theme of the story as shown on the settings of the theme.

Need Help?

If you require any assistance during the character creation process, please don't hesitate to contact our support team at [email protected] or on our Discord.
Last modified 2mo ago