Manojkumar Teluguntla
Manojkumar Teluguntla

Reputation: 21

How to use rasa action_restart

Hello friends,

I am developing simple restaurant_search application using Rasa stack framework. I am very much new to python and machine learning. I was stuck at a point. Here I want to implement action_restart feature of rasa actions when my user starts conversation again from beginning in the middle of the conversation i.e. I need the story to start from the beginning again. Any help is appreciated and Thanks in Advance.

Upvotes: 2

Views: 4062

Answers (1)

Tobias
Tobias

Reputation: 1910

Additionally to a story which handles the happy path (greet-> search_restaurant->select_cuisine), add a story which handles the extra path:

## Story if user says greet instead of selecting a cuisine
* greet
  - utter_greet
* search_restaurant
  - utter_ask_cuisine
* greet
  - action_restart

To do restart through a custom action to:

from rasa_core_sdk import Action
from rasa_core_sdk.events import Restarted

class SomeAction(Action):
    def name(self):
        return "some_action"

    def run(self, dispatcher, tracker, domain):
        # do something here

        return [Restarted()]

You might consider to use the action_default_fallback which is described here: https://rasa.com/docs/core/fallbacks/.

Upvotes: 2

Related Questions