#Simple way to add alternate greetings to a bot!
1 messages · Page 1 of 1 (latest)
So, for an example, I want to make a simple roleplay bot with 3 different greetings, one of which will use a different system prompt. (I won't actually make a working bot, since there is no real reason for this tutorial, but trust me it works!)
Firstly we have to make the json file for the bot, and put all the important stuff there are id, the initial state, stuff we will need in context, etc.
Now, let's work on the initial state, I named it "greeting_choose" since well... You choose the greeting in that state. We need to add the system prompt in the output, rendered text, and the buttons for the greeting. I will make them really short and simple.
"greeting_choose":{
"outputs":{
"context.system_prompt": "This is a fictional roleplay between the user and the AI, taking the character of their big sister, Kate. Kate is older than them, she is caring and supportive of them. Your job is to keep up a conversation between the user and Kate. You can't talk for user.",
"context.memory": ""
},
"render":{
"text": "Choose the greeting",
"buttons":[
{
"content": "She wakes you up",
"description": "In this greeting, she wakes you up",
"on_click": "greeting_a"
},
{
"content": "You come home from school",
"description": "In this greeting, you come back from school",
"on_click": "greeting_b"
},
{
"content": "She is a spoiled brat! (different system prompt/character)",
"description": "In this greeting, she is a spoiled brat and hates you (this greeting uses a different system prompt, basically making it into a different character.",
"on_click": "greeting_c"
}
]
},
"transitions":{
"greeting_a": "greeting_a",
"greeting_b": "greeting_b",
"greeting_c": "greeting_c"
}
}
Now, as you might see, one of the greetings is not like the others, it will use a different system prompt. It isn't necessary of course, but I will make it for this tutorial so you could even more. ||(At this point, you can literally just make endless bots into one, thus saving space for private or public bots. You can even use this trick to make dev bots that have multiple different bots. So if you have a need for that, take this tutorial in mind)|| Also you can see that in that state I set memory to nothing... Again... I will show why later
But now, time to create the greetings themselves. I won't really make them that complicated or long, but to make it more interesting, each greeting will have it's own image.
Greeting 1
Greeting 2
Greeting 3 (different system prompt)
Notice how I decided to change the system prompt in this greeting, making it different, in this situation, a different character.
Let's look closer at the states, to understand what is going on. Firstly, the actual greeting the user sees along with the image link goes to the "text" part. While the part that bot sees in the "context.memory" part doesn't have the image link, since the AI won't see the image anyways, confusing it, so always remember to remove it.
Second, each greeting has a "Go back" button which sends you back to the first state, so the user could choose another greeting if they didn't like this one. That is the reason the first state has an output that empties the "context.memory", since it removes the greeting after user changes their mind.
And finally, each greeting ends with a transition to "chat" if you chat with it, leading it to the final part, the actual AI chatting. So let's go and make it next!
"chat":{
"inputs": {
"user_message": {
"type": "IM",
"user_input": true
}
},
"tasks": [
{
"name": "generate_reply",
"module_type": "AnyWidgetModule",
"module_config": {
"widget_id": "1744218088699596809",
"temperature":0.9,
"top_p":0.9,
"presence_penalty":0.6,
"frequency_penalty":0.6,
"system_prompt": "{{context.system_prompt}}",
"user_prompt": "{{user_message}}",
"memory": "{{context.memory}}",
"output_name":"reply"
}
}
],
"render":{
"text": "{{reply}}"
},
"outputs":{
"context.memory": "{{[...context.memory, {'user': user_message} , {'assistant': reply}]}}"
},
"transitions":{
"CHAT": "chat"
}
}
And that's it, the bot is ready! Now it has three multiple greetings, one of which is a different character entirely.
Here are the pictures from the bot using the three different greetings to show you that it works flawlessly, the code for the bot in this tutorial, and a template for easier use! Obviously, you can remove the system prompt change if you don't want them. You can also create as many greetings as you want, just copy the button stuff at the first state and make a new greeting state.
Remember! The intro message for the bot won't be counted into the memory! 
Don't hesitate to ask any other questions about this or pro config in general 
This is great. Thank you. 