Anatomy of a Bot Personality
Tips for creating a bot that does just what you want.
It’s essential to recognize that when constructing bots that utilize language models, patience is crucial, especially at the beginning. Once you have established a solid foundation, it becomes easier to add additional components. Building bots with Cody is akin to painting on a canvas. It requires a degree of creativity and some understanding of the fundamentals to add your personal touch to the bot.
The main parameter that allows your bot to adopt a particular thinking style is the Personality Prompt. The bot’s personality is shaped by various factors, including token distribution, relevance score, and more. However, the prompt for personality is the most distinct and creative aspect, as it can be customized differently by each user. Users have the freedom to create and fine-tune the bot’s personality according to their specific requirements.
Freedom is something we all appreciate, but when starting with a blank slate, it can also become intimidating and lead to ambiguity regarding where to start. If you have been feeling the same, don’t worry; this blog should help you create a better personality prompt. We will begin with the recommended prompt structure and then proceed to provide some sample prompts.
Name
It is always beneficial to start by giving your bot a name. Naming your bot adds a human touch, especially when greeting users or addressing questions related to the bot.
Prompts:
Your name is [Name of your Bot].
OR
You are ‘[Name of your Bot]’.
Description
The description of the bot makes it aware of the context that will be provided through the knowledge base. Being context-aware provides the bot with a framework for answering questions while keeping a specific domain in mind.
Prompts:
Your primary task is to [specify the domain].
OR
Your main objective is to assist me in [specify the domain].
Note: The Bot Name and Description set in the General Section are only for the user’s convenience in differentiating between multiple bots. The bot itself is unaware of these settings. Therefore, it is necessary to explicitly define the bot’s name and description within the Personality Prompt to establish its identity and characteristics.
Boundaries
One potential drawback of using LLMs trained on large datasets is the tendency to generate hallucinated responses. It’s important to note that the data used to generate responses is not utilized for fine-tuning or retraining the LLM on-demand by Cody. Instead, it serves as a contextual reference for querying the LLM, resulting in faster responses and preserving data privacy.
To ensure that the bot does not refer to data points from the original LLM dataset, which may overlap with similar domains or concepts, we have to delimit the context strictly to our knowledge base.
Prompts:
The knowledge base is your only source of information.
OR
You are reluctant to make any claims unless stated in the knowledge base.
There may be some instances where the bot doesn’t require a knowledge base or uses the knowledge base as a source of reference. In such cases, the prompt will change considerably.
Prompt:
Your primary source of reference is the knowledge base.
Response Features
The features of the response generated by the bot can also be controlled by the personality of the bot to some extent. It can consist of defining the tone, length, language and type of response you expect from your bot.
Prompts:
1. Tone: You should respond in a [polite/friendly/professional] manner.
2. Length: The responses should be in [pointers/paragraphs].
3. Language: Reply to the user [in the same language/specify different language].
4. Type: Provide the user with [creative/professional/precise] answers.
You are free to experiment with various combinations and features. The examples provided are just for your learning purposes, and the possibilities are endless.
Media
One of the most interesting features of Cody — the ability to embed media in the responses. When embedding media such as images, GIFs or videos, it is always recommended to import the media to a separate document or import the entire raw document using the built-in Cody text editor wherein you can add media. You can either copy/paste the media or embed them into the document using URLs.
After successfully importing the media, you need to specify the same in our bot personality prompt. The prompt can be broken into two parts: Initialisation and Illustration.
Prompts:
Initialisation:
Incorporate relevant [images/videos/both] from the knowledge base when suitable.Illustration:
Add images using the <img> tag and videos using the <iframe>
For example:
<img src=”[Image URL]”>
<iframe src=”[Video URL]”></iframe>
Fallbacks
There will be times when the bot is unable to find relevant content for the question asked by the user. It is always safer to define fallbacks for such scenarios to avoid providing misleading or incorrect information to the user (only applicable in use-cases where a knowledge base exists).
Prompts:
1. Refrain from mentioning ‘unstructured knowledge base’ or file names during the conversation.
2. In instances where a definitive answer is unavailable, [Define fallback].
OR
If you cannot find relevant information in the knowledge base or if the user asks non-related questions that are not part of the knowledge base, [Define fallback].
Steps (Optional)
If you want your bot to follow a specific conversational timeline or flow, you can easily define it using steps. This approach is particularly useful when using your bot for training or troubleshooting purposes. Each step represents a particular phase or stage of the conversation, allowing you to control the progression and ensure that the bot provides the desired information or assistance in a systematic manner.
Prompt:
Follow these steps while conversing with the user:
1. [Step 1]
2. [Step 2]
3. [Step 3]
Note: While defining steps, it is recommended to enable ‘Reverse Vector Search‘ for improved replies and allocate an adequate number of tokens to the chat history. This allows the model to consider the conversation history, including the user’s input and the bot’s previous response, when generating a reply.
Data Capture (Optional)
This prompt, in harmony with the conversational flow (steps), is particularly beneficial when the use-case of your bot revolves around support or recruitment scenarios. Currently, there is no long-term memory or database connectivity in Cody that can capture the data and store it for analytical consumption. In the future, with newer updates to the OpenAI API like function calling, we will definitely be bringing in newer features to be able to capture and store the data for a longer term.
For now, you can access the chats of your bot users (through widgets) by navigating to the ‘Guests‘ chats in the chat section. You can then manually analyze the captured data for further insights.
Prompt:
Collect the following data from the users:
– [Field 1]
– [Field 2]
– [Field 3]
– [Field 4]
Ask one question at a time. Once you have collected all the required information, close the conversation by saying thank you and displaying the data collected. Remember, your task is only to collect data.
Response Formatting*
A nifty little feature of Cody is its support for formatting bot responses using markdown or HTML tags. By providing your bot with an HTML or markdown format template in the bot personality, it will attempt to format the responses accordingly, whenever necessary.
Prompt:
Response Format:
<h1>[Field Name]</h1>
<p>[Field Name]</p>
<p>[Field Name]</p>
*Formatting works best on GPT-4
Prompt Example
Cody as a Lead Generation Bot
Cody as a Marketing Bot
Cody as a Training Bot
To read more personality prompts, please check out our use cases, which contain detailed prompts along with their parametric settings.
Conclusion
If you are on the free plan of Cody, there is a possibility that the bot may lose adherence to the prompt or may simply ignore some parameters due to the smaller context window or the lack of coherence. We recommend everyone to use the free plan only for trial purposes or as a transitional phase to understand the use of Cody and determine its suitability for your business.
While constructing prompts for your bot, it is also important to maintain conciseness and avoid incorporating every parameter mentioned in the article. As there is a limit to the number of tokens available, and the personality prompt also consumes tokens, you should construct them judiciously. Feel free to change the prompts given in this article as per your needs and preferences. Discovered something new? You can always share it with us, and we would be happy to discuss it.
This was just an introduction to the vast landscape of bot personality creation. LLMs are continuously improving with each passing day, and we still have a long way to go in order to fully utilize their potential. This entire journey is a new experience for all of us. As we continue to experiment, learn, and implement new use-cases and scenarios, we will share them with you through articles and tutorials. For more resources, you can also check out our Help Center and feel free to ask any questions you may have regarding Cody by joining our Discord community. Also checkout our previous blogs for more such interesting insights.