How to know how many times user asked a specific question + rasa tracker

hello, i have a problem with my code:

scenario: when a user ask a question i would like to ask him based on the confidence level of his intents and entities to confirm or reformulate his question.

Basically i want to interact with the user 2 times (either to confirm or reformulate his demand).

To do so i want to implement a counter.

But i dont know how to count how many times the same question was asked… do you have any suggestions.

scenario case: “hello i’m looking for a restaurant nearby?” bot wd first respond: “hello i’m sorry can you be more precise about your intention?”

usr: “i’m want to eat tonight nearby” bot: “sorry i’m not sure about what you’re asking, be more precise please?”

usr: “i’m looking for a nice place to eat” bot:“ok, since i can not answer you let me redirect you to someone more expert about restaurants”

see here: my bot asked user to reformulate 2 times, since he cd’t give the right answer he decided to lead the user to an expert…

i want to make a function counting the number of times bot asked to reformulate.

do you have any idea?

thank you

Hi @nini,

you don’t need to count anything for this, you can just train your model with stories just like this one. For example:

* fallback_intent
  - utter_fallback
* fallback_intent
  - utter_fallback
* fallback_intent
  - utter_escalating_to_human

Something like this. You then need to disable the default_fallback_action though, because it always rewinds the fallback action. You can do this by adding your own fallback action to your Fallback policy, e.g. you could add this to your policy.yml

- name: "FallbackPolicy"
  nlu_threshold: 0.7
  core_threshold: 0.7
  fallback_action_name: "utter_fallback"  # instead of the default `action_default_fallback`

Just found this again: In the docs, it’s also described you could just train a out_of_scope intent. Not sure what the best way is to train such though

thank you @smn-snkl i’m gonna have a look on your proposition even if i don’t think it matchs my code design.

let you know tomorow :slight_smile: