Dialogflow CX - DetectIntent Response - Alternate matched intent not coming in the response

1.1k views Asked by At

I am trying to replicate a scenario where alternate matched intent returns other intents that have a close match/close confidence score. But the API always returns 1 intent with the highest confidence score and skips all other intents, is there any way to make it function similar to ES version?

Steps followed - Created Intent1 with utterance Check balance and created Intent2 with test balance. And in test window if I type Balance it always returns only Intent2

 "Alternative Matched Intents": [
      {
         "Id": "84383366-215f-40a3-9ba6-464238f0c2aa",
         "Score": 0.5985087752342224,
         "DisplayName": "Intent2",
         "Type": "NLU",
         "Active": true
      }
   ]
1

There are 1 answers

0
Leri On

The "Alternative Matched Intents" field helps you to debug the intents that are matched by user utterance in current flow model, which would also contain the matched intent itself.

Moreover, these intents are only the intents that are referenced in the flow (e.g. used by transition route in the flow page) which are picked up by the flow model.

Note that intents which are not referenced in the flow will not be included in the “Alternative Matched Intents” field.

Here are some sample scenarios where we can use the "Alternative Matched Intents" field for debugging purposes:

Example 1: enter image description here

If you have Intent-1 and Intent-2, which both contain the training phrase "hello" and they are both referenced in the current flow (see image above - Intent-1 was referenced in the Intent1 page and Intent-2 was referenced in the Intent2 page). When the user says "hello" on the start page, Intent-1 will be triggered and both Intent-1 and Intent-2 will be included in the "Alternative Matched Intents" field. Note that the agent is still matching the user utterance to Intent-2 and it is the configuration of the pages/transitions (i.e. the state model) that is resulting in Intent-1 being triggered.

Result: enter image description here

Example 2: enter image description here

If you have Intent-3, which has the training phrase "check balance" and it is referenced in the lower level of your current flow. When the user says "check balance" on the start page, NO INTENT will be matched since based on the current flow, you have to go through Intent-1 and Intent-2 first before Intent-3 could be matched (see image above - Intent-3 was referenced in the Intent3 page). However, Intent-3 will also be included in the "Alternative Matched Intents" field since it is referenced in the current flow.

Result: enter image description here

Moreover, as you can see in the Results above, there is an “Active” field that indicates whether the intent is active or not (the value is true if it’s active and false if it’s not). Basically, Active intents are the intents that are in the current scope. For example, if the user is currently on "Intent1" page, then only the intents in the current flow's (START_PAGE’s) transition route or the current page's (Intent1’s) transition route or transition route group are considered as active intents. See https://cloud.google.com/dialogflow/cx/docs/concept/handler#scope for more details.