Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 (linked below) 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:

...

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 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, and enables the CHW to practice talking to these clients

...

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? 

...

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. Or we could say its the number of client scenarios the CHW works through. Or we could say its 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? 

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 your chatbot 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.

  • 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."