I’ve attempted to use action_back, I saw it referenced here: Default Actions
Is there a guide available on how to trigger it?
I tried just entering /back into the command line and nothing was picked up. Then I created an intent called /back, trained it, and triggered it but nothing happened there either.
Any help would be much appreciated
Is this feature still supported?
nik202
(NiK202)
July 1, 2021, 11:37am
2
@ronankff Hi. I will suggest make an intent like go_back
, and then trigger like this
go_back:
triggers: action_back
actions:
- action_back
1 Like
ronankff
(Ronan)
July 1, 2021, 11:49am
3
Thanks for the reply @nik202 , I’ll give that a shot
Hey @nik202 , I set up the bot as you said. Can you confirm for me that this is the way the back function works:
Story is as follows:
nik202
(NiK202)
July 1, 2021, 3:24pm
5
@ronankff have you updated config.yml file
action_back (Default Actions )
This action undoes the last user-bot interaction. It can be triggered by the user by sending a “/back” message to the assistant if the RulePolicy is configured.
policies:
- name: "RulePolicy"
core_fallback_threshold: 0.3
core_fallback_action_name: action_default_fallback
enable_fallback_prediction: true
restrict_rules: true
check_for_contradictions: true
In your stories, you not mention action?
I guess you using Rasa 1.X ? Right? If you are using Rasa Open Source please updated to Rasa 2.7.1 or 2.6.2
1 Like
I am using 1.x, apologies I forgot to even mention that.
Unfortunately we’re not in the position to upgrade versions right now. According to the Legacy docs the correct policy for this action is MappingPolicy, which I have included
Good spot with the stories file too, I changed it.
Running with the above setup gets me this error:
I’m a bit confused because as far as I can tell action_back doesn’t need to be initialised in the actions file.
nik202
(NiK202)
July 1, 2021, 4:33pm
8
@ronankff
did you mention this in domain.yml?
actions:
- action_back
Is your action_back is a function in action.py with trigger utterance?
An alternative solution, if you want to go back to the previous menu. In that, I can help if you want? For Rasa Ver 1.X
For example:
Bot: How are you doing? or some menu
Rasa | Rasa X
User: I’m fine
Button: previous menu
User: user select previous menu
Bot: How are you doing? or some menu
Rasa | Rasa X
and so on.
I am sorry, a lot have change from Rasa 1.x to Rasa 2.7.1. It’ bit confusing for me also But, I honestly want to assist you @ronankff
1 Like
Yes, I have the action registered in the domain. My action_back is not a function in action.py yet. I thought that it would be built into Rasa as it’s a default action. Do I have to create it myself? If so, what code do I need?
Thank you for offering an alternative but I the product owner wanted something that would take you back in the conversation. For example:
User - Hello
Bot - Hello, how can I help?
User - See menu
Bot - menu options
User - /back
Bot - Hello, how can I help?
Does that make sense to you?
nik202
(NiK202)
July 1, 2021, 5:11pm
10
@ronankff Yes.It fine customer is always right! Mean while if you can share your all files it will be great to test. Thanks.
1 Like
nik202
(NiK202)
July 1, 2021, 5:42pm
12
@ronankff python version? can you create the requirement file for me
pip freeze > requirements.txt
1 Like
ronankff
(Ronan)
July 1, 2021, 5:47pm
13
Python 3.9.5
[REMOVED]
Was the original command I used to set that up.
nik202
(NiK202)
July 1, 2021, 5:51pm
14
@ronankff using rasa-x?
Hope you aware of this You can install Rasa Open Source using pip (requires Python 3.6, 3.7 or 3.8).
Its fine if your rasa x is running on python 3.9
1 Like
ronankff
(Ronan)
July 1, 2021, 6:06pm
15
I’m not using rasa x for this particular task. I’m just trying to make a small demonstration of the back button working and then we’ll add it to the larger project once we know it works.
nik202
(NiK202)
July 1, 2021, 10:29pm
16
@ronankff You want something like this? Sorry for late reply was busy in office work and deadlines.
OR
you want to go back to the previous step/stage every time? When you say “go back”, “back”, "put me
back "
Please consider this (back option) process (dialogue conversation) based on the project. Can I ask what’s are your project objective?
I have taken this thread How to use action_back? - #9 by ronankff as a example and checked and fixed your code.
Please give me more example(as shown in above thread) so that I can help you more. Thanks.
2 Likes
ronankff
(Ronan)
July 1, 2021, 10:48pm
17
Oh no problem man, I appreciate the help.
Ideally what they want is that the bot goes back to the previous step. That’s why I’m trying to get action_back working.
The project has a lot of conversations and sometimes people press the wrong button or whatever and want to go back and hit the right button.
nik202
(NiK202)
July 1, 2021, 10:50pm
18
@ronankff Oh my bad, I see the example and based on that trying to fix. I will see much more tomorrow. Its late now in UK. Will find solution
1 Like
nik202
(NiK202)
July 3, 2021, 11:57am
20
@ronankff I have seen some example, everyone using action_back function. But nothing is working as they have suggested. Do you have any links which I can see and try to fix your code.
ronankff
(Ronan)
July 3, 2021, 12:50pm
21
Would you mind sharing these examples? I can try implement them myself, it’s just hard to find anything on it.
nik202
(NiK202)
July 3, 2021, 12:51pm
22
@ronankff Sure Please.
@erohmensing Hi,
Here is an example of my code.
In a FormAction, I would like for the user to be able to correct his answer and go back to the former question.
For example, the bot will ask for the name (“nom”) and the user will write it. The bot will then ask for the surname. At that moment, if the user write “retour”, the bot should ask again for the name (and put the right value in the slot).
action.py
Class CreateForm(FormAction):
“”“Example of a custom form action”""
def name(self):
…
@ronankff
OK, in case anyone is still struggling with the Mapping Policy of Rasa 1.0, this is what I did to make it work:
Put this in endpoints.yml
action_endpoint:
url: "http://localhost:5055/webhook"
Create an actions.py in your working folder with your custom action. For me, this was:
from rasa_sdk import Action
from rasa_sdk.events import UserUtteranceReverted
class FaqEnrollment(Action):
"""Revertible mapped action for utter_faq_enrollment"""
def name(self):
return "action_fa…
@ronankff
import copy
import json
import logging
from typing import List, Text, Optional, Dict, Any, TYPE_CHECKING
import aiohttp
import rasa.core
from rasa.core.policies.policy import PolicyPrediction
from rasa.shared.core import events
from rasa.core.constants import DEFAULT_REQUEST_TIMEOUT
from rasa.nlu.constants import (
RESPONSE_SELECTOR_DEFAULT_INTENT,
RESPONSE_SELECTOR_PROPERTY_NAME,
RESPONSE_SELECTOR_PREDICTION_KEY,
RESPONSE_SELECTOR_UTTER_ACTION_KEY,
)
This file has been truncated. show original
@ronankff
@ronankff Honestly, I have seen so many examples, and want to provide at-most help. But, some process is hard to implement, so as a developer we found the atternative. If I found any more links or even solution; I will post here. Cheers!
1 Like