Chatbots have become an increasingly popular means of interaction, thanks, in part, to the recent boom in AI bots’ popularity. Among them, GPT-based chatbots are gaining the most attention for their conversational abilities.
As you probably know by now, ChatGPT is a large language model developed by OpenAI. The model uses deep learning techniques to understand user inputs and generate natural language responses in a way that sounds natural and human-like.
These user inputs can be simple questions or prompts that give the chatbot a task to perform.
Well-crafted prompts will allow you to unlock your GPT chatbot’s full potential. So let’s have a look at the main strategies to write the best prompts for your bot so that you can boost their quality and effectiveness.
Understanding ChatGPT Prompts
Prompts play a crucial role in shaping the output of language models like GPT-3.5. In this context, prompts are what guide the chatbot’s response generation process. They provide the starting point and lay out the context for the model to understand what the user wants from it.
In simpler terms, a prompt is nothing more than a set of instructions for your GPT chatbots.
Depending on your goal, prompts can take different forms, such as a question or a statement. These prompts are then processed by the model, which generates a coherent and contextually relevant response based on the information it has been trained on.
For something more straightforward, like requesting information, a prompt can be formulated as a question, directing the model to answer it in its response. However, if you want GPT to perform a more complex or even creative task, like writing a story, the prompt will need to include other elements, such as tone of voice or style, so that the outcome matches your expectation.
Types of GPT Prompts
Different types of prompts will elicit different types of responses from GPT chatbots.
Closed-ended prompts, like yes or no questions, or questions that are just looking for a specific piece of information, will restrict the bot’s response to a narrow set of choices, leaving little room for misinterpretation or deviation from what was asked.
On the other hand, open-ended prompts give the bot more “creative” freedom to generate any kind of response. The broader or more generic the prompt, the more this creativity will show either in the length of the response, how it’s phrased, or even how accurate it is. It’s something very different to ask a GPT bot to, for example, “write social media copy to promote my new product” than to ask: “Write social media copy of bout 150 words to promote my new product, highlight that X and Y features are new, and use a friendly, yet convincing tone.”
The answers resulting from each type of prompt will be more or less a match to what you were expecting and might need more or less tweaking until you reach the desired result. But sometimes, a bot will go rogue and make up an answer altogether. When that happens, it’s called a hallucination.
Writing clear prompts for your GPT bot can minimize the probability of it hallucinating. So, without further ado, let’s dive into…
Guidelines for Writing Effective GPT Prompts
As was just mentioned, a clear prompt will help your GPT chatbot yield the best possible results. But what exactly does a “clear prompt” entail?
In our “Building WhatsApp Chatbots Powered by AI” webinar, we walked attendees through building a GPT-based customer satisfaction bot that was designed to collect data and summarize the incident in case a customer was unsatisfied with the service/product.
The bot’s goal was to collect the customer’s order number, email address, and a summary of what went wrong — the reason they were interacting with the bot.
Would a prompt like “you’re a customer support bot who collects users’ information to solve their problem” work? Maybe, to a certain extent. But we didn’t want to leave any room for hallucinations, so here’s the prompt we used instead:
A client (@name) is contacting us because something went wrong. You must act as a friendly agent in charge of collecting a clear idea of what went wrong with the order, you need to ask them. We know there was an issue but we need to know what it was, so you need to find out. Also, get their email address and order number (don't show the summary to the user and do not create any info.) Ask only one question at a time and be friendly. Your job is not to give support, only to collect the information. Don’t create any information, it must be given by the client. Here's your conversation history with the client: @conversation_history. Once you've gathered all three pieces of information from the client and they no longer need help say ‘An agent will look into this’, be sure to use the keywords ‘An agent will look into this’ only when you have a clear summary of the issue (at least one sentence from the user), an order number, and an email address and the client no longer needs help. Client: @user_text. You: \n"
With this prompt as a guideline, let’s break it down and have a look at the main tips and strategies for effective prompt writing.
1. Define the Conversation Context
To engage a GPT chatbot successfully, your prompt should provide a clear context of the situation at hand. Start by setting the scene for the conversation; this will allow the chatbot to understand the context and provide more accurate responses.
Just think about exactly what you want to GPT to generate or achieve, and provide it with the prompt that’s most likely to get there.
In this case, we opened the prompt by telling the chatbot why someone is interacting with it — “a client is contacting us because something went wrong” — and then telling it its role in the situation — “you must act as a friendly agent in charge of collecting a clear idea of what went wrong with the order, you need to ask them.”
As you see, this is a much more specific starting scenario than just telling GPT it is supposed to take on the role of a customer support chatbot.
2. Be as Specific as Possible
This leads me to strategy number two — you should aim to be as specific and clear as possible when writing your prompts.
Vague or ambiguous prompts might lead to your GPT bot hallucinating, or simply producing an outcome that’s not what you were expecting or which doesn’t meet your expectations.
For example, when I asked ChatGPT to “write about prompts”, it produced eight paragraphs about prompts, but didn’t provide much detail on any of the topics it mentioned. However, when I made my request more specific, it gave me exactly what I asked:
For the AI WhatsApp bot we built during the webinar, we also aimed to be as detailed as possible. We included the tone of voice/personality we wanted the chatbot to use (“you must act as a friendly agent”), and we told it what it needed to do (“find out” what the issue was) and how (“don't show the summary to the user and do not create any info”; “your job is not to give support, only to collect the information.”)
In the end, we even told the chatbot the keyword it should use once it had all the information needed and could finish the conversation. This way, we guaranteed that the customer wouldn’t be stuck in a conversational loop, but also that the chatbot would use the desired phrase we wanted (“An agent will look into this”) to finish the interaction.
3. Take Turns
If you’re using GPT to perform a task for you, like writing a piece of text or doing research on a topic, you can take multiple turns in your prompts. So instead of asking for everything all at once, you can create a back-and-forth exchange that keeps building on the bot’s previous response. This way, you can funnel down the conversation until you’ve reached the desired outcome.
In the case of our WhatsApp bot, we didn’t do this in the prompt, since we used just one. What we did was instruct the GPT bot to be dynamic in its interaction with the customers: “Ask only one question at a time and be friendly. “ This way, the customer’s experience will be more conversational and, thus, feel more natural.
4. Incorporate User Context
Incorporating user context in your prompts can enhance the personalization and relevance of the conversation. This can be their name, location, or something else that’s relevant to the context at hand. Whatever you pick, it should make sense to create a more tailored experience.
If you’ve been using Landbot for a while, you’re probably familiar with Variables, which allow your bots to store a user’s answers under specific “boxes” that can be used later on in the conversation.
Because our example GPT bot is a WhatsApp chatbot, it means you already have your user’s name, without having to ask for it. It also means that you can personalize the conversation right from the start. All you need to do is tell the bot where that information is stored (“A client (@name) is contacting us”), and that’s it.
5. Provide Examples
We didn’t do this for our chatbot, but a great tip is to include examples of what you are or are not looking for so that GPT can come up with a more accurate response. This helps it understand your expectations more clearly.
In our bot-building scenario, for instance, we could have included in the prompt an example of a friendly interaction with a customer. Like this:
“Ask only one question at a time and be friendly. Here’s an example of how not to ask for information: Hello, can you please give me your order number, and contact information and tell me what’s wrong, please?”
6. Test and Iterate
Even though there are tips and strategies you can follow, crafting prompts for a GPT chatbot is an iterative process. So before you set it out in the wild, you should test and tweak it as needed.
You can experiment with different phrasings and approaches to understand what works best for your bot’s goal. You should test your prompts as you go and observe how the chatbot responds. Then, you can analyze the generated output and refine your prompts accordingly.
The more you repeat this process, the better outcome your chatbot will achieve, and the better you will become at writing effective prompts.
More Tips & Examples
Even though ours is a good example of a prompt you can use to quickly and easily build a chatbot with GPT-3 for your WhatsApp channel, it is, of course, not the only one.
If you’re looking for more inspiration to get your prompt writing journey started, here are a couple more.
In this LinkedIn post, Sam Szuchan highlights how powerful GPT’s outcomes can be if you feed it the right prompt. He exemplifies the difference between asking GPT what museums he can visit in Madrid:
And asking GPT to act like a travel guide who gives location-based recommendations:
The second prompt yielded a much more complete and personalized response, that is more helpful than just a list of places to visit. Check out his post to see more prompt examples.
Another useful tip from a different example is to have GPT as YOU questions before you give it an actual task, so that it has all the information it needs to better help you.
In this Instagram post, you can see how the user applies this trick before asking GPT to come up with content ideas for their business.
In this relatively recent world of GPT chatbots, well-crafted prompts can make the difference between being successful in your GPT business strategy and needing help to keep up with the technology.
By following these guidelines, you’ll be on your way to creating killer prompts for your GPT bots that will unlock their full potential.