Switching Intents Mid Form (Unhappy Path?)

I’ve gone over most of the material on forms and stories, however I cannot seem to solve this issue:

Say I have intents intent_one and intent_two. intent_one, when activated, triggers a form with a required slot filled by an entity. This is how I have the story set up:

## intent_one happy path
* intent_one
  - form_intent_one 
  - form{"name": "form_intent_one"}
  - action_intent_one

action_intent_one is an action triggered when the form is filled correctly. form_intent_one is the form action to initiate the form. This works fine when a utterance is posted to rasa that activates intent_one. I do have issues with resetting the set slot, but I think that is just a matter of resetting the slot once the form action submits.

The main problem I run into is when intent_one's form does not get completed, and the user’s next utterance is suppose to trigger intent_two. The story I have for this is:

## intent_one unhappy path
* intent_one
  - form_intent_one 
  - form{"name": "form_intent_one"}
* intent_two 
  - action_intent_two

I tried deactivating the form with returning self.deactivate() in the validate method - this works for deactivating the form for that go around. However, when intent_one is activated again, the form is not activated. A few ideas come to mind: does self.deactivate() affect all future forms of that instance? and/or should I structure another story like this:

## intent_one sort of unhappy path
* intent_one
  - form_intent_one 
  - form{"name": "form_intent_one"}
* intent_two 
  - action_intent_two
* intent_one
  - form_intent_one 
  - form{"name": "form_intent_one"}
  - action_intent_one

Thank you for taking the time to read this, and I appreciate the feedback!

not a full answer, I’m just getting into forms. But do your forms require custom python code for related actions? Could be the error is in there?

Thanks @dcsan! I do have fully implemented actions for both the form action and base actions. I’m (possibly incorrectly) assuming that these are working fine, and that the issue is in the story construction.

Hi @ttlekich

Your first two stories are inconsistent: After the events

* intent_one
  - form_intent_one 
  - form{"name": "form_intent_one"}

the first story says that Rasa Core should predict action_intent_one, while the second story says that it should predict action_listen. (Btw.: since Rasa 1.8 you can run rasa data validate stories on the command line to automatically identify such issues.) So you have to insert something there that distinguishes the successful and unsuccessful situations. For example, you could featurize the slot that you are interested in and write it out in your stories as - slot{...}.

Here is some more information on story conflicts (although slightly outdated now): https://colab.research.google.com/drive/1We1EcSp_uA31OooC78sReryhMCkOjEKM#scrollTo=wjuOCW9Zkcgl

Thanks @j.mosig! That certainly helps. I’ve been playing around with rasa interactive as well and learning that the stories I am making are not valid and/or learning from seeing the explicit steps. rasa data validate will help a ton.

Edit: Ah well, have been on Rasa 1.4.4 - should have mentioned this in the original post. This is an excuse to upgrade.

@j.mosig this is awesome!

btw where did you read about 1.8? I had just run through the install but didn’t think to ask for a specific version. I just checked /announcements and can’t see it there either.

I know because I developed the validation feature :grin: , but you can stay up to date by following the changelog: https://github.com/RasaHQ/rasa/blob/master/CHANGELOG.rst :slightly_smiling_face:

1 Like

oh cool. the validation feature is rad.

however I noticed it does flag extra things that the normal training process doesn’t flag. I haven’t quite got to the bottom of that yet.

Is there a way to combine validation with visualize to get clearer indication of where in your flow things are broken?

/dc

1 Like

@dcsan What exactly do you mean by “extra things”? The output depends on the max_history. If you get errors from rasa data validate stories without setting max_history, then you cannot fix things by increasing the max_history and the stories that it displays are definitely in conflict.

We are thinking about making the output more informative and/or interactive. If you have a specific vision of how this should look like, please tell!