Restart a chat conversation

Hi

I have written some stories and want to restart the conversation. The problem is after the story flow over, it starts behaving in strange ways. Dialogue management provides wrong bot action towards correctly identified the event.

I am using rasa core .10.04

Here is my sample story. –

## success story without issue
  • greet
    • utter_greet
    • utter_ask_location
  • enter_data{“location”: “banglore”}
    • slot{“location”: “banglore”}
    • utter_thankyou
    • action_search_store

Generated Story -7817183320599229400

  • greet
    • utter_greet
    • utter_ask_location
  • enter_data
    • utter_thankyou
    • action_search_store
    • utter_ask_location
  • enter_data{“location”: “banglore”}
    • slot{“location”: “banglore”}
    • utter_thankyou
    • action_search_store
    • utter_anythingelse
  • deny
    • utter_goodbye

There is a default action provided by Rasa called action_restart. Maybe you want to add that at the end of each story. The action is stated at Actions all the way at the bottom of the page.

I am using rasa core .10.01.

When using it I am getting exception–

with `utter_`. Error: {}".format(action_name, e))
ValueError: Action 'action_restart' doesn't correspond to a template / action. Module doesn't contain a class with this name. Remember to prefix actions that should utter a template with `utter_`. Error: 'action_restart'

Oh, I’m sorry then, I missed out what version of Rasa Core you were on. I’m on v0.11.12 so I’m sorry I don’t think I can help you.

OK It was solved.

using the class

class ActionRestarted(Action):
""" This is for restarting the chat"""

def name(self):
    return "action_chat_restart"

def run(self, dispatcher, tracker, domain):
    return [Restarted()]

and include this action in bot’s domain file.

1 Like

you should be able to just add - restart to the end

## fallback out of scope
* out_of_scope
  - utter_default
  - action_restart

This is the story I used to restart a conversation, however, it doesn’t run.

fuck you

2018-11-08 00:01:44 **DEBUG** rasa_core.tracker_store - Recreating tracker for id 'default'

2018-11-08 00:01:44 **DEBUG** rasa_core.processor - Received user message 'fuck you' with intent '{'name': 'out_of_scope', 'confidence': 0.8998591899871826}' and entities '[]'

2018-11-08 00:01:44 **DEBUG** rasa_core.processor - Logged UserUtterance - tracker now has 6 events

2018-11-08 00:01:44 **DEBUG** rasa_core.processor - Current slot values: 

requested_slot: None

slot_against: None

slot_agree: None

slot_reason: None

slot_thesis: None

slot_topic: None

2018-11-08 00:01:44 **DEBUG** rasa_core.policies.memoization - Current tracker state [{'intent_greet': 1.0, 'prev_action_listen': 1.0}, {'prev_utter_greet': 1.0, 'intent_greet': 1.0}, {'intent_out_of_scope': 1.0, 'prev_action_listen': 1.0}]

2018-11-08 00:01:44 **DEBUG** rasa_core.policies.memoization - There is no memorised next action

2018-11-08 00:01:44 **DEBUG** rasa_core.policies.ensemble - Predicted next action using policy_2_KerasPolicy

2018-11-08 00:01:44 **DEBUG** rasa_core.processor - Predicted next action 'utter_begin_option' with prob 0.97.

@akelad What’s the syntax of adding ‘restart’? Do you mean simply adding it to the end of the story? I did this and it seems not working:

* ask_weather{"location": "大和市"}
    - action_ask_weather
    - slot{"time": "午後"}
    - restart 

The history (slot values) from previous utterance is still remembered.

Should be action_restart as far as I know

1 Like

When I am chatting with my bot after running rasa shell, I type /restart but the bot response strangely. Is there any better way?

1 Like

Try training using Rasa X - Interactive Learning. While training it will generate a story. Train your bot the correct actions (also check if the intent is correct) it should perform in the interactive learning.

Hi @akelad

I tried all the above solutions mentioned here. But had no luck finding the solution.

I added the following code in the action.py file:

from rasa_core_sdk import Action
from rasa_core_sdk.events import Restarted

class ActionRestarted(Action):
""" This is for restarting the chat"""

def name(self):
    return "action_restart"

def run(self, dispatcher, tracker, domain):
    return [Restarted()]

and also

- action_restart

at the end of each story.

But still it throws some error in the terminal when I try to train the RASA model after making changes to these files using

rasa train --force

Attached is the screenshot from the command line.

Please let me know if I am doing something wrong here or is there any other way to reset/restart the bot conversation in Web UI.

Thanks