How to ask user for intent matching approval?

Hello Rasa community!

I’m trying to add a feature in my chatbot so that when the confidence of the intent matching is below 50% the chatbot will send a response back saying something like “I’m not really sure what you are asking for. Would you like information about X?” where X would be some text about the intent it matched.

I have already implemented a minimum nlu and core threshold for the Fallback Policy which gave me the idea I previously described. Does anyone know a way to check the confidence of each message-to-intent matching? Also, how can I use a text describing each intent to use in this feature? For instance, let’s say I have two intents, one related to weather and the other related to public transport. When the intent confidence is below 50% for both intents the desired output of the feature would be:

“I’m not really sure what you are asking for. Would you like some info about the weather?”

and

“I’m not really sure what you are asking for. Would you like some info about public transport?”

The text describing each intent must be dynamically included in the response. Any ideas and suggestions will be highly appreciated!

Hey @stavr! If you get the tracker.latest_message attribute, you should have the full parse data of the latest message, which includes the intent ranking. That should help you get the info you need.

With regards to providing specific text for different intents, we do a similar thing in our demo bot. Actually I think the implementation itself might be something that you could work off of! We overwrite the default action_default_ask_affirmation here to give the user buttons based on the intent ranking, with descriptions pulled from this file.

2 Likes

Hey @erohmensing! Your reply has pointed me in the right direction. I’ll try and implement this based on your demo. Thank you very much for your assistance!

Hey @erohmensing! Your suggestion worked like a charm! Just one more question. Is there anyway to set the value of a specific slot, when the user selects one of the suggested intents?