This article shows you how to build and understand the working of a Knowledge Graph for your Virtual Assistant. It shows how to convert an FAQ into ontology, add tags, use terms, add alternate questions, synonyms, tags, and traits.
For details on the implementation process, please refer here.
Throughout this use case article, we will be building a Knowledge Graph for a Travel Planning Assistant. This article discusses both the basic setup of a Knowledge Graph, but also the solutions at hand for cases of ambiguity.
Static FAQ
Let us start by creating a static FAQ without an ontology.
To add a static FAQ, follow the below steps:
- Open the Travel Planning Assistant.
- Navigate to Build > Conversational Skills > Knowledge Graph.
- Click Create to create a Knowledge Graph.
- A Knowledge Graph with the name set to the Bot Name is created.
- Click Add Intent to start entering your FAQs.
- Select Intent type as FAQ.
- Add Question and Bot Response; then click Save.
- Click Add Intent on the top-right to add more FAQs.
- After you enter all the FAQs, click Train to train the Knowledge Graph.
- Click Talk to Bot at the bottom-right to check the response for the added FAQs.
Tags
Tags help filter the FAQs based upon the presence of some key phrases in the user utterance. This helps identify the intent more efficiently and prevents the assistant from providing users with irrelevant responses. We recommend that you add tags to every question, unless you have a large list of FAQs. In this case, you need to create an Ontology (see below for details). To add tags to an FAQ:
- Hover over the Question then click the edit (🖉) icon.
- In the add tag text box, you can find some suggestions by the Platform based on the phrases present in the question. You can pick one from the list or type your own custom tag.
- Train the assistant.
- Talk to the Bot, and use an utterance that points to the FAQ you added tags to. Formulate the request in different ways, to find potential tags to add.
Ontology
For a better response, you must add tags for every question. But this solution is not feasible in case we have a big list of FAQs or questions with common tags. Ontologies help in this situation because they rely on key words and frequently occurring words/phrases to organize FAQs in groups and subgroups.
Each group can be a node in the ontology. You can have multiple levels of the nodes forming a hierarchical structure. Moving the relevant FAQs (intents) to the nodes will associate that FAQ with the corresponding node name set as a tag.
Here is an example Ontology:
- Reservation
- Make
- How do I pay for my booking?
- Update
- How do I update my booking?
- Cancel
- Can I cancel my reservation?
To create an ontology, follow the below steps:
- Hover over the Knowledge Graph name on the left pane and click + icon to Add Child Node. For example, we can add a node for questions related to international travel, and one for reservation related questions.
- Add.
- To add subgroups, hover over the node and use the corresponding + icon to add child nodes.
- Repeat the process for questions related to
- To add questions to your newly created ontology, select them from your list of FAQs, then drag and drop them onto the relevant node. You will notice the path gets updated accordingly.
- Edit a question and see that the node name is added as a tag. This ensures that this question is qualified for a user utterance containing the term/node name.
Note that the tags you added earlier are retained and you can delete them, whereas the node names cannot be deleted from the tags list.
- You can further add nodes to your Ontology. The illustration below shows you the Ontology that we will be working with moving forward.
- Train the Knowledge Graph and use Talk to Bot.
- There should not be any changes in the responses.
Term Usage
By default, the node names or terms are used in evaluating the path and coming up with a set of qualifying questions. You can tighten or relax this rule by either making the term mandatory in the utterance or marking the term/node as organizer respectively.
Use Case 1: You want to ensure that the intentions regarding Cancel Reservation must be considered only when the user asked a direct question regarding the topic.
To address this case, we mark the term Cancel as Mandatory. This helps improve the assistant’s performance.
Steps:
- Hover over the node, in this case, cancel, and click on the settings icon.
- From the Settings section, select the Mandatory option from the dropdown next to the term name.
- Save and Train the Knowledge Collection.
- Now the questions under this node are considered only if the user utterance has the node name, cancel in this case.
Use Case 2: Consider the following FAQs that need to be added to the Knowledge Graph.
- Contact
- Who do I contact in case of an issue?
- What is your helpline number?
- Complaints
- Where can I register my query/complaints?
- Issues
- How do I report a problem?
Though they do not have any phrases or terms in common, they are related to Customer Care. For ease of understanding, we can put them under a node by the same name and mark it as Organizer node, ensuring that the intents get qualified without the need to have the term phrase in the user utterance.
Steps:
- Create a node called Customer Care.
- Create the above three nodes as child nodes to this new node.
- Hover over the node, in this case, Customer Care, and click on the settings icon.
- From the Settings page, select the Organizer option.
- Save and Train the Knowledge Collection.
- Now the questions under this node are considered even if the user utterance does not include the node name.
Synonyms
Use Case: If you test the VA for How do I make a booking?, while your Knowledge Graph contains How do I make a reservation? you might get a suggestive match that is not definitive. The reason is that the assistant does not understand booking as being the same as reservation.
Solution: Synonyms
To add synonyms, follow the below steps:
- Hover over the reservation node and click the settings icon.
- In the Path Level Synonyms, add booking. Path level synonyms are useful in such cases because they apply to all nodes.
- Save and Train the VA.
- Talk to Bot and use the same query How do I make a booking?
- Similarly, we can define Knowledge Graph Synonym if it is applicable to the entire knowledge graph.
Alternate Questions
Some questions have multiple ways the user can approach them.
- Is there a way to see my reservation details from my laptop?
- Is there a mobile app that I can use to access my reservation?
Both of these questions pertain to one intent: How do I access my reservation online?. But instead of adding all these Q&As as intents and repeat the response and the settings, if any, you can add these questions as alternate questions.
To add alternate questions, follow the below steps:
- Hover over the question, in this case, How do I access my booking online? and click the edit icon.
- In the Add alternate question enter the question.
- Add the queries mentioned above.
- Save, Train, and Talk to the Bot.
- Entering any of the above three questions will yield the same response as the question How do I access my reservation online?
Task Execution
Consider the query How do I check my flight status?. If the VA has a task that can give the balance, we can direct the user to it, instead of asking the user to use the utterance to trigger the task.
To trigger a task, follow the below steps:
- Before proceeding, ensure that you have a Dialog Task defined for Check Flight Status. Let us consider a dummy dialog that displays a message. Learn more on adding tasks by reading Using the Dialog Builder.
- Click Add Intent How do I check my flight status?
- Set Intent to Task.
- From the drop-down list select the Check Flight Status Dialog Task.
- Save and Train the Knowledge Graph.
- Talk to bot with the utterance How do I check my flight status? will trigger the Check flight status task.
Ontology Tags
Use Case: When asking the VA: Does your airline support mobile checkin? the response might be: Did you mean How do I check in online?.
The reason for this might be that: Does your airline support mobile checkin? is a very close match to How do I check in online?. You can avoid such situations by adding a tag (i.e.: mobile) and marking it as mandatory to the alternate question Does your airline support mobile checkin?.
Solution: Custom Tags
To add tags, follow the below steps:
- Edit the question How do I check in online?
- For the alternate question: Does your airline support mobile checkin?
- Add the tag mobile
- Click the tag to open the Tag Settings, then set Tag Usage to Mandatory.
- Click Done.
- Save and Train the VA.
- Now Talk to the Bot and see the response.
Traits
Use Case: I lost my boarding pass, how do I get another boarding pass?
You will get the response for How do I get a boarding pass?
While this is a valid response it is not the right one. Ideally, since the user said I lost my boarding pass, the assistant must direct the user to information that helps them regenerate their boarding pass.
Solution: Traits. Traits are used to get additional information from the user utterance and direct the user to a better solution.
To add traits, follow the below steps:
In this document you have seen various settings for building and managing a Knowledge Graph. For details regarding the implementation and functionality of Knowledge Graph, please refer to this document.