Prompt user for valid entity when the entity detected is not on the list of the items (and when entity is optional)

I’m trying to build different instances of ‘Get balance’ task. Here are the scenarios that I want to cover:

  • Display the total balance of all accounts when no account is detected in the utterance
  • Display the specific account balance if the utterance has an account and the account is detected on the list of my accounts.
  • Display a message “I did not recognize the account you are referring to” if the utterance has an account and the account is not on the list.

Right now, with my dialog flow, I can do only the first two scenarios. Do I need to build a script to cover the third scenario?

Hi @pastapareo,

Your 3rd scenario is open ended and we can never predict what would be the wrong / unknown account.

  1. I highly recommend you to present the user with a generic response ’ I can only help you fetch following account balances: … ’ kind of bot response for the scenarios account not specified and account not found (1 & 3).

  2. This is a bit messy yet may suffice your requirement. You will have to use the script node , parse user input , put some patterns/ regex to extract additional text and present appropriate text.

Regards,
Karthik

Re 2: I strongly recommend not trying to parse the raw input with regex in script nodes (and Kore.ai people, STOP recommending this!). There are far too many situations to handle for this to be effective, and actually is impossible to be perfect because a script node does not have enough information about how the utterance has been processed up to that point.

So the three alternatives I would suggest are:

  1. Have a second entity on the “did not find anything known” path that looks for other kinds of accounts, presumably there are words that could indicate an account.
  2. In a similar manner, use a trait that is trained for detecting potential accounts and you can test for the presence of that trait in the connections from the Account entity (after the specific match).
  3. Use a composite entity. There would be two sub entities associated with it, one for matching specific accounts (like now) and a second one for the fallback matching. Then you have two composite entity patterns, the first with just the specific sub entity, and the second with the fallback sub entity. The processing of a composite is such that it processes the composite patterns in order and will stop at the first successful match.

@andy.heydon
Thanks for your suggestions. I’m currently using the first one at it works fine :slight_smile:

I added another scenario, where the user can specifically ask for his total balance (of all accounts), and I used traits for that. I’m also adding another scenario for account types and products and I think I can also use traits for this one.