Dialogue Tree
This chapter will introduce: what is dialogue tree, and how to create a dialogue tree type of skills on the platform.
What is Diaglogue Tree?
Dialogue Tree vs FAQ
Using FAQs in scenarios that have multiple dialogue branches, you need to list all the situations that may occur when adding responses to let the user look up for the one that matches the most. It not only leads to redundant response that hard to read, but also makes the agent less "smart". For example,
User asks: "Why is my milk powder lumpy?"
Agent answers: "If the packaging is intact and lumps are found just after opening, it may result from the uncertainty in logistics and transportation. If the color or smell of the milk powder is abnormal, we do not recommend you consume it. If the packaging has abnormal wear, as milk powder is very hygroscopic, the milk powder will come into contact with the air, absorb the moisture and produce lumps or deterioration. Once the powder quality has changed, it is no longer recommended for consumption. Please check the integrity of the packaging when you purchase the product and take care of the storage. If consumed for a while and still within the shelf life, lumps found during consumption are mostly related to reasons such as damp storage environment or improper storage. Milk powder should be stored in a light, cool and dry place, not in a refrigerator. It also has to be kept away from electrical appliances. It is important to consume the opened product within the shelf life of use, seal it well in time after each consumption and do not change the packaging container for storage after the milk powder opening. If the milk powder has passed the shelf life, for canned milk powder, it is recommended to consume it within 1 month after opening; for box-packed and bag-packed milk powder, it is recommended to consume it within 2 weeks after opening. Every time after consumption, store the milk powder in a cool, dry place with an airtight container. If the product's shelf life is exceeded, it is no longer recommended to consume it."
However, if the agent can give responses based on the user's questions and branch selections, we can bring users a better experience. example
As you can see in the example, this dialogue tree has the ability to
- Lead the user to the follow-up process when the user asks a question about caked milk powder.
- Get the key information of
time of discovery
andwhether it is within the shelf life
by asking the user and giving a targeted response. - Recognize the user's
affirmation
intention in spoken expressions such asYeah
andYep
. - Jump back to the corresponding node when recognize the user has re-responded to a previous question.
Definitions
Dialogue Tree: These skills are built like a "tree", which consists of hierarchical tree-like branches. The elements in the branches are nodes, and the parent-child relationship establishes levels between the nodes of the tree. According to the user's question and branch selection, a corresponding response is given. For example, if users ask why the food has spoiled, you will need to give different answers and follow-ups depending on the date of purchase and the condition of the spoilage.
Node: The smallest unit that composes the dialogue tree, which is divided into ordinary nodes and three special nodes:
- Ordinary node: The node where the agent sends a question to the user for more information. Many ordinary nodes are connected according to the hierarchy and the parent-child relationship to form the dialogue tree.
- Start root node: The root node of the dialogue tree. When the user triggers the dialogue tree skill, the agent starts the flow from this node.
- Abnormal end node: In each node, if the agent fails to jump to any other node after the number of queries exceeds the maximum times, it will quit the dialogue tree abnormally. You can set the response to send when the agent comes to an abnormal end here.
- Successful end node: When the process is complete, in other words, when the dialogue tree reaches a child node, the agent will send a successful-end response after the response of the child node.
caution
When the agent repeatedly asks the same question exceeding the maximum times, it will give an abnormal end response and a successful end response in turn. So please make sure your successful end response is inclusive.
- User said: When the message sent by the user meets any of the conditions configured in the "User said", it will jump to the corresponding node.
For example, in the root node, the agent asks the user: "Have you purchased the insurance products?" The root node has two child nodes, child node A with "User said" configured as "Purchased" and child node B with "User said" configured as "Have not purchased".
In this way, when the agent is at the root node and the user responds with "No, I have not purchased the insurance products", the agent will jump from the root node to the child node B ("User said"-"Have not purchased").
caution
If there is no corresponding childe node that can meet the user's response, the agent will jump to the first child node by default.
Agent say: When jumping to these kinds of nodes, the agent will send the configured response automatically and wait for user's response to jump to the corresponding child node based on the information provided by the user.
Slot to fill: It is used to collect key information from the user to determine which child node the agent will jump to.
Agent reply: Once the slot to fill has collected the information, the agent will send this reply automatically, and then jump to the child node.
caution
The Agent say and Agent reply share the same reply strategy in one node. If the strategies are configured different, it will go with the one applied to Agent say.
How to create a Dialogue Tree?
As the dialogue tree is a complete process, you need to sort out the process before creating the agent.
- How many nodes can be divided into in the whole process?
- For each node, what is the intent to trigger it?
- After triggering this node, what response can the agent send to put the process forward?
Take the previous mentioned "milk powder" session as an example, the structure of the dialogue tree can be shown in the image below:
Create a dialogue tree
Click "+CREATE" of the skill management page, select Type as Dialog Tree to create a new dialog tree skill.
Fill in the name and category of the dialogue tree, select or create an Intent as the intention to trigger the skill. When the user's message is recognized as this intent, the agent will trigger this skill. As shown in the structure, the trigger intention is "Why is the milk powder lumpy".
After selecting the intent, you can click the "Edit intent" button to make modifications to the intent.
After adding the skill description, click "Save", the newly created dialogue tree will be displayed in the skill list. Click the Enter button to start building the dialogue tree.
Canvas operations
After clicking the Enter button, a new process canvas page will open, and the dialogue tree is built here. Let's take a look at how this canvas works。
Hovering the mouse over a node or clicking the small button on the left side of the node can evoke the following operation buttons: Create Child Node, Edit Node, Copy Node, Children Only, Delete Node:
You can quickly edit the node by double-clicking it. Click on the small triangle to the left of the node to quickly expand and collapse the node's children.
Order and parent-child relationship of nodes can be changed by dragging.
The canvas has two views: Tree and Story. The Tree view shows the structure of the dialogue tree better, while the Story view can help you sort out the possible conditions in a more convenient way.
Pre-set nodes
When you enter the canvas for the first time, there will be three pre-set nodes: Start root node, Successful end node and Abnormal end node.
In the Start root node, the "User said" is the trigger intent selected when creating the skill. Apart from modifying intents outside of the canvas, you can also make modifications here.
You can set the first response to send after the intent being triggered, as well as the slot to fill to put the process forward.
- In the successful end node and the abnormal end node, you can edit the end words of the agent in the two end scenarios, and the configuration method is similar to the knowledge question and answer.
According to the structure of the dialogue, the first response send by the agent is "When did you find lumps?"
The agent needs to get the key information -
time of discovery
from the user.Because the information is collected by recognizing user's intent, the "Slot to fill" here can be set as empty.
note
Currently, the platform supports two ways to collect and fill the slot: fill by word, fill by sentence.
For more details, see Slots.
- In the Successful end node and Abnormal end node, you can set the reponse to send when the flow ends successfully and abnormally separately.
Customized node
To build the dialogue tree, you also need to create some customized nodes, as well as its trigger intent and the responses to send.
As you can see in the previous shown structure, after sending the response of the start root node,
When the user says
time of discovery
is "After a period of consumption", the agent asks "Is it still within shelf life?" to get another key information -whether it is within the shelf life
. Therefore, we created a child node and configure it as mentioned before.When the user says
time of discovery
is "Just after opening", the agent asks "Had the packaging been intact before opening?" to get another key information -whether it is within the shelf life
. Therefore, we created another child node and configure it as mentioned before.
Similarly, the rest nodes are configured according to the dialogue tree structure. Then we have a complete dialogue tree as shown below.
Dialogue tree settings
- Click "Skill Settings" in the top right corner of the canvas, you can change some settings according to the needs of the scenario.
- Maximum Repeat per Node
- At each node, if the agent fails to collect the information to fill the slot, it will not be able to jump to the next node. Therefore, the agent will keep sending the response set in this node.
- If the number of queries at a node exceeds the maximum number of queries, the agent will quit the dialogue tree and give an abnormal end response and a successful end response in turn.
- Other skills can be triggered in this process
- During a conversation, the user may not follow the dialogue tree flow exactly, but suddenly bring up a question that can trigger another skill. Therefore, if you want the agent to be able to complete an intent switch within the flow, reply to the cut-in question first, and then return to the current flow, you can set it enabled.
- Ending rule at leaf node
- Quit
- Keep
- Click the "Train" button in the top bar of the page. When it is shown that the training is successfully done, you can click "Test" to start a conversation with the agent.