Building Bots: Prompts Overview

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 say we wanted a different kind of chatbot- for example, a chatbot to train community health workers (CHWs) in Malawi. Some questions we'd want to think through before we 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 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

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.

  • You can review some difficult household visits the CHW may have had and help them think through how they could have approached them better.

  • You can quiz the user on myths and facts about family planning.  

  • You can teach the CHW some resilience and self-care practices, such as breathing and hydration.

  • You can help users set a SMART goal to save money

  • You can help the user improve their financial literacy. If they choose this option,  quiz them on the difference between wants and needs using music, perfume, and alcohol as examples of wants, and food, school fees, and oil as examples of needs. Only ask about one item at a time."