Rajesh K Jeyapaul  (jrkumar@in.ibm.com) Riya Mary (riyamaro@in.ibm.com)
Cloud Soln Architect , Dev Advocate and startup Mentor – IBM Dev Advocate – IBM


Watson Conversation is one of the powerful service made available through Bluemix. The dialog component of the Conversation service uses the intents and entities that are identified in the user’s input, plus context from the application, to interact with the user and ultimately provide a useful response.

A dialog is made up of nodes, which define steps in the conversation. Dialog nodes are chained together in a tree structure to create an interactive conversation with the end user.  You can think of the node as an if/then construction: if this condition is true, then return this response.

At the beginning of each conversation, dialog evaluation begins at the top level of dialog nodes.

Each time the dialog returns a response,  it stores the ID of the node at which the conversation should resume. This node is called the contextual node.

  • In the first stage, the dialog tries to find an answer in the child nodes of the contextual node. That is, it tries to match all the conditions of the child nodes of this contextual node.
  • In second stage  it tries to find an answer to a particular input by matching the top level of dialog nodes.

If the last selected dialog node has children, it is set as the contextual node for the next round, and the dialog evaluation in the next round starts from the child nodes of this contextual node.

The order of your dialog branches is important. When a user input is received, and the intent and entity have been identified, dialog base nodes are evaluated in the order in which they appear.

Below is the problem statement where though the order is followed and the correct Intent and entities are returned, Dialog fails to get the proper response.We have presented what was missing in this particular case and how it has to be resolved.

Conversation Dialog Objective:

The intention is to list all the clients belonging  to particular industry verticals .For example:

  • List clients pertaining to Finance
  • List clients pertaining to AI
  • List clients both from Finance and AI

Problematic Dialog  Flow:

 Child node has Finance , Finance and AI (logical AND ) and AI as the flow in the order


Problem statement:

  • Repeating the same question does not yield the expected conversation response
  • For Example:
    • Q: Can you list me Finance Clients ?
    • A: ABC  ( which is correct )
    • Q: Can you list me Finance clients ? (same question repeated )
    • A: XYZ (which is wrong)
  • Not reaching the correct dialog response in spite of getting the correct Intent and Entity

Corrected Flow:

Start the child node with Logical AND, in this case, Both AI AND Finance, then to Finance and then to AI

  • Provide a jump to from parent node (clients ) to the child node

Why this behavior ?

Dialog flow retains the last executed child node as context node. In this case, since the logical AND operation is inbetween, if the same question is repeated, then dialog moves from the existing context node (child node ) to the next child node . If it finds the logical AND/OR , then it tries satisfy that and come back with the different response.

In case if the condition is not met, it follows through and goes back to the virtual root node and comes back to parent node and handles the default message

Building the dialog flow is very important and recommend to understand this and test the behavior before moving on with the next level of implementation.

For any queries , pls. feel to  reach out to us.

2 comments on"Importance of Watson conversation Dialog Flow – How to handle Logical conditions !!"

  1. Hi Rajesh, Hope your doing fine. I want to ask you about watson conversation. How can I check or control if user input “hi” while asking something else to the chat bot example cancel policy and suddenly say “Hi”. In my case it goes to the greeting node which is at the top. is there a work around for this. Please let me know Thanks

  2. Deepak C Shetty November 01, 2017

    Some issues/mistakes I see in the article…
    1) In the problem flow.. you show the response as “ABC” for client:Finance but for the corrected flow you show it as XYZ for client:finance.. WHY ? This just adds to the confusion!
    2) In the problem flow, why does the response comes as XYZ when asked the same question again… XYZ is triggered only when client:AI is satisfied and the question is about finance clients… so XYZ should never be the response… please clarify this

    Due to the mix of the above 2 issues.. the article raises more doubts/confusions than clarifying any!

Join The Discussion

Your email address will not be published. Required fields are marked *