State-machine-like chatbot in Rasa

Hey,

I’d like to create a Rasa chatbot scenario which is divided into separate stages. In each stage a user is supposed to input an expected intent and if the intent is not detected, fallback message is used as an action.

Context: You are an English language learner who is interacting with language-tutor chatbot. The bot says:

  • “Now, please - introduce yourself” later, if detected intent is “intent_introduction”, the bot proceeds to the next question. If not, it asks to repeat and gives you some hints how you can introduce yourself.

Then, it asks for your favourite colour, sport, etc. Every “stage” of the conversation waits for an expected intent and doesn’t change topics / jump from one to another. The scenario is very straightforward and fixed.

Is it possible to implement such use case in Rasa? Stories are not really what I’m looking for, because I want to be 100% sure that (for example) “intent_colour” wont trigger the bot when it waits for “intent_introduction” or “intent_sport”. And as far as I understood, Rasa stories are generally designed to handle conversations which are not fixed. Even though I studied Rasa documentation for a while, and checked for similar questions on the forum, I couldn’t find clear solution for this.

Cheers

You can use Forms for this.

Hmm, I don’t think that forms are applicable here.

Correct me if I’m wrong, but as far as I know, the forms can omit some questions on the way if all the slots are filled with a single intent.

Example: -intent: “I’m Alex and I like blue” Will fill slots ‘name’ and ‘fav_colour’ at once.

I think Mateusz’s diagram works more strictly:

  • action: “What is your name”
  • intent: “My name is Alex and I like blue” should trigger an action like
  • action: “Nice, but I asked about your name only” and fill the ‘name’ slot. Then in Stage 2, it should ask for colour separately.

Forms can be dynamic as described here. You can override the required_slots method.

For example, define a required slot, stage_1_complete and use validate and/or required_slots to determine whether you can move on to the next stage.

Thank you! This topic can be closed.