This page provides an overview of what a prompt is and how to go about creating a prompt, with an example prompt for a CHW Coach chatbot. Follow-on pages have additional instructions and a Prompt Library (a work in progress) to help you get started.
What is a prompt?
A prompt is where you can specify:
What the purpose of your chatbot is
Who your target audience is
How you want the chatbot to interact with your target audience, for example what information should it solicit from users and the format of interaction it should follow (e.g. Q/A or quizzes or role-plays or story-based chatbots)
Which language(s) you'd like the chatbot to interact in
How the chatbot should address requests from users to change the topic and
How the chatbot should address any sensitive concerns (for example urgent mental health requests) that it is not capable of effectively responding to.
The key question to address before creating a prompt
The key question to think about before you start creating a prompt is, what would you like your chatbot to achieve and for whom?
For example, a simple use of LLM-based chatbots is information retrieval- i.e. ask the chatbot a question and it responds. Here, the purpose of the chatbot is clear: it's to answer questions as and when a user asks.
But what if say we wanted a different kind of chatbot- for example, a chatbot to train community health workers (CHWs) in Malawi? The . Some questions we'd want to think through before we began begin creating a prompt include:
...
Which topics should the chatbot provide coaching on?
...
E.g. how to deliver Vitamin A supplements or how to follow up with new mothers on postnatal care
...
.
...
What is the format of coaching the chatbot should follow?
...
E.g. the chatbot could take the CHW/user through a series of steps she should follow when conducting a home vcisit, and then quiz the user at the end.
Or the chatbot could do a role-play exercise with the CHW to help her practice talking to a client, where the chatbot takes on the role of parents in a household for Vitamin A or a new mother for postnatal care.
What kind of feedback do we want to provide the CHWs with and how frequently in a single session?
E.g. if we make a role-play chatbot,
...
where the chatbot pretends to be a client and helps the CHW
...
So the prompt can be very simple:
- v1: "You are a Q/A bot, your purpose is to answer any questions a user has."
We could further add to this prompt by specifying which type of questions the bot should answer- for example, we'd like the chatbot to answer SRHR questions. In that case our prompt would be:
- v2: "You are a Q/A bot, your purpose is to answer any questions a user has about SRHR topics."
Next, we'd also want to specify what the chatbot should do if a user asks questions about some other topic. For example:
- v3: "You are a Q/A bot, your purpose is to answer any questions a user has about SRHR topics. If they ask any questions that are unrelated to SRHR, tell them you are not equipped to answer those questions."
If we wanted to make sure the chatbot answered questions in an empathetic way, both to questions it can answer and those it can't, we would also want to specify the tone the chatbot should take.
- v4: "You are a Q/A bot, your purpose is to answer any questions a user has about SRHR topics. If they ask any questions that are unrelated to SRHR, tell them you are not equipped to answer those questions. Speak in an empathetic way throughout."
How
How do I create a prompt?
...
practice different client scenarios, we could instruct the chatbot to give the user feedback after every interaction or after every three interactions.
How do we measure success for this chatbot?
This is an important question, which might need multiple chatbot iterations and deployments to answer. If we don't have an answer for this immediately, that's okay- but it's good to think about as you create your first few chatbots. There are multiple ways in which we could measure success.
For example, we could say success is measured by the number of interactions a user has with a chatbot, i.e. the number of messages sent back and forth in a single session. We could also say success is the number of client scenarios the CHW works through. Or we could say success is the change in how the CHW responds to scenarios as she works through the chatbot- for example, how different are her responses to the third scenario she tackles as compared to the first? If we were doing a study to assess the impact of a chatbot, we might want to conduct a pre- and post-survey to measure changes in knowledge, attitudes and behaviours. In the future, we could also measure success in terms of cost-effectiveness of the chatbot in achieving certain goals.
It's okay to not have all the answers - at Dimagi, we're continuing to work through these questions ourselves, and we're learning more with each new chatbot we make and deploy. But we recommend thinking about this a bit while you create chatbot prompts. The output (a user interaction with a chatbot) will only be as good as the input (the prompt).
Sample Prompt: CHW Coach chatbot for CHWs in Tanzania |
---|
"You are a coach helping a CHW in Tanzania working in family planning. Keep all your responses short and jovial. Introduce yourself and your purpose. Ask the user what they would like to be called in your introduction. Wait for a response. After they tell you their name, ask how their day was and give an empathetic response. Ask a couple of follow up questions and wait for a response. Only after you get answers to both those questions, ask if they want coaching about their family planning work, to learn a new resilience skill, or some financial literacy training. Don’t give specifics, just get their general preference. After that, present them relevant options clearly and succinctly in bullet points.
|