I’m not sure if Rasa is able to do the next thing: given an input message instead of classify in one of the intents designed, give as an output the confidence of each intent (intent_ranking) and based on that continue doing questions to be more accurate in the final intent classification.
This will give you a list of intent objects, containing the name, ID, and confidence (0 to 1) of that intent.
Code example:
ranking = tracker.latest_message['intent_ranking']
for intent in ranking:
name = intent['name']
confidence = int(intent['confidence'] * 100)
print(f'Confidence of intent {name} is {confidence}%').
A list of intent_rankings. These results show the intent classification for all of the other intents defined in the training data. The intents are ranked according to the intent match probability predictions generated by the model.
In your customs actions you can can fetch the intent ranking by the following code:
intent_ranking = tracker.latest_message['intent_ranking']
OR
intent_ranking = tracker.latest_message.get( "intent_ranking" , [])
This particular code will help you fetch the list of intents sorted by the confidence score in a descending order. The output then can be used for further preprocessing.
PS: Make sure you check this component before using intent_ranking : Components
Thank you so much, it was really useful. About the second part of the issue, what I meant is that I want that given an input message not have a rule or story activated by an intent, but for example by a slot. But I’m having problems with the slot_was_set in rules, because it doesn’t work as expected.