We are using the NativeChat sample "Book a doctor" to demonstrate how the Cognitive Flow works.
For the "Book an appointment" conversation there are 3 questions steps with 3 entities - doctor, date and time.
It is like 3 slots that need to be filled by the user answering bot's questions.
For each conversation, the developer must provide example expressions that trigger it. The process of providing examples to the Natural Language Processing (NLP) engine is called Training.
The user starts interacting with the chatbot. "Book an appointment" is recognized as the trigger expression for this conversation.
The bot starts executing the steps in the same order as they are defined in the Cognitive Flow.
The aim of the first step is to extract the value of the entity doctor from the user's input.
In order to fill the slot, the bot asks the users which doctor they would like to see.
The user answers the question.
They may provide information for more than one entity with one expression.
The NLP engine detects that and extracts the structured data - doctor name and date.
The bot goes through the process of filling the slot for each detected entity. This includes evaluating the so called reactions - validation, disambiguation etc. - before the slot is filled.
The evaluation of reaction is triggered:
When the bot identifies the entity without explicitly asking, it will acknowledge with a special message to the user.
The bot can validate user input based on various rules, e.g. proper email, regex or even call an external API.
If the users are having repetitive conversations, the bot can display their previous answers as suggestions. The users can pick them instead of typing the reply.
There are cases where a bot can identify multiple values for a given entity, and it will use the message to ask the user which one is correct.
The bot doesn't have to go through the question step asking for date because the slot is already filled.
Now when the slots for doctor and date are filled it's time for the bot to execute the next step of the conversation.
It asks the user for the exact time of the appointment. The time slot is the final entity needed.
The user responds to the bot's question and finally the last slot has been filled successfully.
When all the slots are filled the user receives a message from the bot with a wrap-up of all the information gathered in the conversation.