Follow up intent's in Rasa Core

Hey, it is more of a suggestion that like in any other nlp how can we create a followup intent for a particular task. I f their is a way to that can i get an explanation?

Could you explain what you mean?

I want to implement a dialogue structure for my bot like for example -

Q- I want to reset my account password

B- Please provide me with your employee id for verification

Q- ok my id is 78945612

B- Enter your Phone number for otp (or a form for changing password)

Here i want every thing in hierarchical manner i.e if user tries to say that

my employee id is 78945612

at the start itself like without providing bot details as to why he/she is providing bot the employee id instead of taking into password change process their i want my bot to process a fallback instead or i want to restrict him to go direct. But yes if user says

i want to reset my password my employee id is 78945612

then i want to take user to OTP step / change password form.

I am handling my bot mainly using http api i.e actions are being handled at my application side itself.

I hope this explains well. if not i can explain with more for better understanding

Thanks in advance!

@souvikg10 can u help me out in this ?

You just have to write stories for these cases. Also form actions might help you: http://rasa.com/docs/core/slotfilling/

will writing stories work as i am not using actions for bot’s response, will it restrict the intent flow like i told above?

@akelad stories are not restricting the conversation flow i.e if i am wrtiting this directly -

U- my mobile number is 202-555-0128

Bot is not showing fallback. I want this line only to be processed when user types for changing password before that if user types this bot should go for a fallback.

I trained multiple story formats sending some for instance -

Generated Story 747428812086775797

  • Welcome
    • action_welcome
    • slot{“email”: null}
  • ChangePassInt
    • action_reset_pass
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum
  • ResetPassInt
    • action_reset_pass
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum

Generated Story -604942949671929005

  • ResetPassInt
    • action_reset_pass
  • MobNoChngePassNo
    • action_mobNumNo
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum
    • export

Generated Story -5440499909656260829

  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum
    • export

Generated Story 1234813730434599654

  • ResetPassInt
    • action_reset_pass
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum
    • export

Generated Story 4770773152861233770

  • Fallback{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • export

The issue is with your stories here,

Generated Story 747428812086775797

  • Welcome
    • action_welcome
    • slot{“email”: null}
  • ChangePassInt
    • action_reset_pass
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum
  • ResetPassInt
    • action_reset_pass
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum

Generated Story -604942949671929005

  • ResetPassInt
    • action_reset_pass
  • MobNoChngePassNo
    • action_mobNumNo
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum
    • export

## Generated Story -5440499909656260829

*** MobNumberInt{“mobNum”: “202-555-0128”}** ** * slot{“mobNum”: “202-555-0128”}** ** * action_mobNum** ** * export**

– This story has no previous state, so when you write only my mobile is 123, this storry is followed.

Generated Story 1234813730434599654

  • ResetPassInt
    • action_reset_pass
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum
    • export

## Generated Story 4770773152861233770

*** Fallback{“mobNum”: “202-555-0128”}** ** * slot{“mobNum”: “202-555-0128”}** ** * export**

– this story expects an intent Fallback, but your sentence is " My mobile is 123" is not trained as fallback instead it is trained as MobNumberInt which is following the story above.

i know it expects another intent but this will mess up the training phrase i want to restrict the flow not to mismatch intents. Right now my bot follows global intent structure i want to make it into a tree structure i.e MobNumberInt should always be called whenever user ask to change password not before that

You have to differentiate states in chatbots. The point of a story is to follow a conversation from one state to another.

If your MobNumberInt as no previous state such as the case with your stories , it is assumed as an initial state of the conversation , you should make sure MobNumberInt is not trained as an initial state, however if for some reason , It has assumed that it is in initial state, you create a story for it and push it to fallback.

Intent1–> action1 → Intent2 → action2

In this story, action2 can only be invoked if in the previous state- action1 was performed.

But what if a user starts with Intent2 and you want to avoid action2 to be triggered because there is no previous state, you put another story

Intent2 → action_fallback

Meaning Intent2 without a previous state should always trigger action fallback.

We do that with Inform intent , if user for no apparent reason types a name of a country and we are not sure in what context as there are no previous state that indicates we need to perform a transaction, we push such stateless intents to fallback

Second option is to use this

They provide some input validation

i tried the option 1 now my bot takes fallback action even if i go through the password reset state/flow. How much stories will it take to to fetch right actions???

Generated Story 747428812086775797

  • Welcome
    • action_welcome
    • slot{“email”: null}
  • ChangePassInt
    • action_reset_pass
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum
  • ResetPassInt
    • action_reset_pass
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum

Generated Story -604942949671929005

  • ResetPassInt
    • action_reset_pass
  • MobNoChngePassNo
    • action_mobNumNo
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum
    • export

Generated Story 1234813730434599654

  • ResetPassInt
    • action_reset_pass
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum
    • export

Generated Story 7356772062411829981

  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_fallback
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_fallback
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_fallback
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_fallback
    • export

Generated Story -4065469404060626646

  • Welcome
    • action_welcome
    • slot{“email”: null}
  • ResetPassInt
    • action_reset_pass
  • MobNumberInt{“mobNum”: “202-555-0128”}
    • slot{“mobNum”: “202-555-0128”}
    • action_mobNum
    • export

thanks for the second option i really needed that :slight_smile:

option 1 should also work, which policies are you using,

Also try to evaluate your models as well. I think it should be balanced, you can use interactive learning to improve the behaviour over time. you don’t need a lot for the stateless stories, if you are using Memoization Policy , Also add one without the slot filled as well.

Is your slot featurised? is it categorical? or text?

i am using MemoizationPolicy & KerasPolicy and my slot is text. I am training stories using interactive learning itself only not doing it manually therefore it is picking up the phone number from the phrase itself. I will evaluate my model to see the result will post it later