Search code examples
rasa-nlurasa-core

How FormAction works in rasa core?


Below story is mentioned in rasa core docs -

happy path

  • request_restaurant
    • restaurant_form
    • form{"name": "restaurant_form"}
    • form{"name": null}

My interpretation is if a reponse is passed to rasa core with intent "request_restaurant" then it will call "restaurant_form" action which is basically a form-action and form policy jumps in to handle coming requests.

But I am unable to understand what is use of below two lines.

  • form{"name": "restaurant_form"}
  • form{"name": null}

Solution

  • The first one form{"name": "restaurant_form"} is activating the form and the second one form{"name": null} is deactivating the form again. This makes more sense when looking at the unhappy path:

    ## chitchat
    * request_restaurant
        - restaurant_form
        - form{"name": "restaurant_form"}
    * chitchat
        - utter_chitchat
        - restaurant_form
        - form{"name": null}
    

    Here the form stays active while performing actions outside the form and is only deactivated after filling all requested slots from the form.