Search code examples
watson-conversation

How can I get intent value in condition of IBM Watson Assistance user interface?


In the section of If bot recognizes I can say intents[1].confidence > 0.4 but I can't know what is actually that intent, So is there a way to get that?

I can get all intents type and confidence in the Respond section with <? intents ?> object but it does not help in If bot recognizes section.


Solution

  • You can get the intent by just using intents[1].intent. Just be aware that you are requesting the second choice, not the first. The first one would be intents[0].

    If you have a complex tree you want to parse, looking for this each time can be an issue. So there are two approaches.

    1. Load a context variable with the intent name, and check for that. This adds overhead in your object store, but allows you to be more dynamic.

    2. If it is the second choice you want, and you don't care about the first choice: On your main execution node, set intents[0].intent = intents[1].intent and the same for confidence. This will allow the normal lookup to take over.

    There is more details on the objects in Watson Assistant here:

    https://console.bluemix.net/docs/services/conversation/expression-language.html#access-intent