This documentation page is still being written.
In this quick guide, we will create a more advanced bot model that uses FAQs, knowledge graph data and queries. This bot was used as a demo at the Conversation Design Festival, held on June 15th, 2021 and organized by Conversation Design Institute.
Step 1: Welcome message
bot "Hey! Are you ready to celebrate conversation design with us?"
when user "yes"
else when user "no"
bot "Let me tell you more about it then"
bot "It's gonna be great fun! We have lots of great speakers"
bot "We’re even gonna do awards for best personality, best ROI, all those sorts of things"
Notice we can use example messages from the user, like "yes" and "no" and these are interpreted as the full intents i.e.
Step 2: FAQs
Let's add some FAQs to our conference bot. Check out
nlu/faqs.co to see how we've defined the
faq_tickets user intents:
define user faq_when
"when is the conference"
"when is it happening"
"what is the date of the conference"
define user faq_where
"when is it taking place"
"where is it"
"where is the conference happening"
define user faq_tickets
"how much does it cost"
"how much is a ticket"
"where can i buy a ticket"
Next, we define the FAQ flows:
user "when is the conference"
bot "~on June 15th, 2021"
user "where is the conference"
bot "Well, it's an online conference. I don't know the exact URL just yet"
bot "But at the end of the festival, all the students that graduated this year, we’ll give them a dance floor"
bot "A virtual one, obviously"
# COST / TICKETS
user "how much does it cost"
text: "A ticket is $150 and you can get one here"
bot "And we're donating some of the proceeds to the Foundation that’s going to give out scholarships to people that want to learn about conversation design, but don’t have the means for it"
If you look closer at the flow for
faq_when you'll notice that the bot message has a
~ (tilde sign) in front of it. This instructs the playground's NLG engine to create a contextual response i.e. a response that provides the given information, but in the context of the question.
Try asking the same question in various ways. For example:
- When is the conference?
- When does the conference begin?
- When is the first day of the conference?
Step 3: Knowledge Graph Data
Let's give our bot more information about the conference. For this, we've created the
data.yml file. If you're not familiar with the YAML syntax, you can read a quick introduction here.
First, we provide the information about the conference, in a structured way. Next, we provide three list of objects for sessions, speakers and companies.
Notice that we use the type of the object, capitalized, as the name of the list i.e.
Step 4: Queries
To allow the user to ask questions about the conference data, there are a few things we need to do:
- Define the query intents (see
- Define how the user talks about the objects (see
- Define the query flows (see
- Define how the data should be displayed (see
# SPEAKER QUERIES
define user query_Speaker|all
"who are the speakers"
"who will be speaking"
"who is speaking"
define user query_Speaker|by_company
entity company as Company
"who is coming from $company"
"who's coming from $company"
"anyone from $company"
# SESSION QUERIES
define user query_Session|all
entity speaker as Speaker
entity session as Session
"what are the sessions"
"what are the topics of the conference"
"what is this conference about"
TODO: explain queries
TODO: explain contextual questions i.e. "what about X"
TODO: explain ambiguity i.e. "is Maarten speaking?"
In this quick guide, we've looked at adding a simple welcome behavior, handling FAQs, adding data to the knowledge graph using a YAML file and enabling the user to ask the bot questions about the speakers and the sessions.