How to trigger a Dialog when Watson assistant chat is giving same intents in a row?

821 Views Asked by At

1) when is the user is chatting, system is giving same answer (hitting same intents in row i.e 3 three times) at that time we need to trigger a dialogue that will ask "Sorry i don't know the answer do you want to contact customer care ?

2) Same scenario to trigger the dialogue when three times continuous low confidence example conversation confidence is lesser than 30 percentage.

Kindly comment below for clarification

3

There are 3 best solutions below

0
On

This is easy in Watson Assistant and you can do it all in one node.

First create a node above the welcome node, like so.

enter image description here

Why do this? It will allow the node to always execute, and because it is linked to the welcome node, it won't be impacted by nodes below welcome if they move.

Click on the node, and click the cog to set it to a "multi-response node". Then fill out as follows:

enter image description here

1) Set this to input.text == "". This prevents the node firing when your first connection is made. Without this you will get an error.

2) Click on the cog and set up the following.

enter image description here

This will set the last intent, and reset the counter.

3) Click save, and then click the cog for the second line. Fill out as follows.

enter image description here

This will increment the counter if the last intent matches the current one.


The first line will trigger if third intent is hit.

I'm only using text, but you would more likely put a context variable or keyword to tell your application layer to redirect to a human.

I've uploaded a sample workspace.

https://pastebin.com/2FumZbcH

2
On

This can be done outside the Watson Assistant tooling. I always recommend a "wrapping application" that consumes Watson Assistant API handle items like this. You will need to count the number of times a particular intent is triggered in a row. You will also be able to evaluate the low confidence, and count there as well.

Here is a code snippet from the Node example for confidence:

function updateMessage(input, response) {
  var responseText = null;
  if (!response.output) {
    response.output = {};
  } else {
    return response;
  }
  if (response.intents && response.intents[0]) {
    var intent = response.intents[0];
    // Depending on the confidence of the response the app can return different messages.
    // The confidence will vary depending on how well the system is trained. The service will always try to assign
    // a class/intent to the input. If the confidence is low, then it suggests the service is unsure of the
    // user's intent . In these cases it is usually best to return a disambiguation message
    // ('I did not understand your intent, please rephrase your question', etc..)
    if (intent.confidence >= 0.75) {
      responseText = 'I understood your intent was ' + intent.intent;
    } else if (intent.confidence >= 0.5) {
      responseText = 'I think your intent was ' + intent.intent;
    } else {
      responseText = 'I did not understand your intent';
    }
  }
  response.output.text = responseText;
  return response;
}

Adjust the numbers as you see fit.

The rest of this particular implementation is here: https://github.com/watson-developer-cloud/assistant-simple

0
On

you can keep track of the number of times things were hit as context in a dialog node. But the above is correct in that your client application will have to do the handoff to the live agent, or make that connection however you do it. you could also just show a phone number or link as your response from dialog as well to keep it simple (but less helpful for the end user)