Stop/quit conversion inside the form action

can “stop/quit” intents use to quite the whole conversion in RASA framework ?

if user want to quit the form he do not want to continue filling details in form.

when i tried with ActionRestart/action_deactivate_loop options in rules its only going to validation form only. Any assistance you could provide would be appreciated

@naveenjr could you please confirm your rasa and python versions, as well as share your training data files to advise further?

when i tried with ActionRestart/action_deactivate_loop options in rules its only going to validation form only.

Not sure I understand this scenario, could you please share your debug log and any custom action code you’re using?

@anca sharing you the the details .

nlu file:

  • intent: stop

    examples: |

    • stop

    • i want to stop

    • i don’t want to do this anymore

    • cancel

    • abort

    • i want to do other actions

    • i changed my mind

    • hold

    • just a second

    • hold on a second

rule file:

  • rule: stop the bot

    steps:

    • intent: stop

    • action: utter_stop

    • action: action_deactivate_loop

    • action: action_reset_all_slots

domain file response:

utter_stop:

  • text: AI-assistant stopped, say hi when you need me later.

action file ::

class ActionResetAllSlots(Action):

def name(self):

    return "action_reset_all_slots"

def run(self, dispatcher, tracker, domain):

    return [AllSlotsReset()]

rasa details:

Rasa Version : 2.8.1

Minimum Compatible Version: 2.8.0

Rasa SDK Version : 2.8.1

Rasa X Version : 0.39.3

Python Version : 3.8.12

Operating System : Windows-10-10.0.19043-SP0

outside form action its stopping and giving response .when the bot is inside the form its giving the details are not correct (say entity is wrong ) please provide the correct entity . chat bot is not giving utter stop .its is stuck inside form validation method only .

Great, thanks for the extra info @naveenjr Could you also explain further what is the current bot behaviour and what would be your desired expectations? At a first glance, I have 2 observations:

  • You could write a story to handle this stop path like in the example in the docs; please note that the story example uses a step declaring that active_loop is null.
  • Resetting all slots will mean that the form will request the required slots once it becomes active again, is that your assistant’s intended behaviour?

thanks for the prompt response . @anca i have 4 forms to deal 4 use-cases may be it will increase upto 10. in that case are you suggesting add 10 more extra stories to deal all the stop intents in each uses case?

i have tried the same @anca .my rasa shell output is not exiting from form validation in stop intent

story ::

  • story: User interrupts the form and doesn’t want to continue

    steps:

    • action: cart_roles_form

    • active_loop: cart_roles_form

    • intent: stop

    • action: utter_ask_continue

    • intent: stop

    • action: action_deactivate_loop

    • active_loop: null

rasa shell out– Your input → hi

rasa response:- ? Hi! Welcome to bot, please select options from below. 3: CART Roles and Authorizations

rasa response:- Please provide the complete transaction

Your input → stop

rasa response:-This look like invalid transaction code.Please provide the complete transaction code. Please provide the complete transaction

Your input →

how many times i give stop intent also still showing “This look like invalid transaction code.Please provide the complete transaction code” msg only

my custom action code

class Validate_CART_Roles_Form(FormValidationAction):

def name(self) -> Text:

    return "validate_cart_roles_form"

def validate_transaction(

    self,

    slot_value: Any,

    dispatcher: CollectingDispatcher,

    tracker: Tracker,

    domain: DomainDict,

) -> Dict[Text, Any]:

    """Validate `first_name` value."""

    # If the name is super short, it might be wrong.

    print(f"transaction given = {slot_value} length = {len(slot_value)}")

    patter_match=re.search(Regex_pattern_trans,slot_value)

    # if patter_match!= None:

    #     print(f"pattern = {patter_match.group(0)} length = {len(slot_value)}")

    #if len(slot_value) > 25 and patter_match!= None:

    if len(slot_value) < 30 and patter_match!= None:

        return {"transaction": patter_match.group(0)}

        #dispatcher.utter_message(text=f" I'm assuming you mis-spelled.")

        #return {"transaction": None}

    else:

        #return {"transaction": patter_match.group(0)}

        dispatcher.utter_message(text=f"This look like invalid transaction code.Please provide the complete transaction code.")

        return {"transaction": None}

i am kind of stuck for this situation, Any assistance you could provide would be appreciated. @nik202 @ ChrisRahme could you help out of this situation ?

@naveenjr Is it possible to share the full debug log by running rasa shell --debug to understand what predictions are being made by the dialogue manager when the input stop is given?

@anca … sorry for the delay…

below logs are i am getting for this command." the rasa shell --debug "

Please provide the complete transaction code,

Your input → stop

2022-04-26 14:10:20 DEBUG rasa.core.lock_store - Issuing ticket for conversation ‘f3f560ddff4440f6bf8905b5c1ea6d56’. 2022-04-26 14:10:20 DEBUG rasa.core.lock_store - Acquiring lock for conversation ‘f3f560ddff4440f6bf8905b5c1ea6d56’. 2022-04-26 14:10:20 DEBUG rasa.core.lock_store - Acquired lock for conversation ‘f3f560ddff4440f6bf8905b5c1ea6d56’. 2022-04-26 14:10:20 DEBUG rasa.core.tracker_store - Recreating tracker for id ‘f3f560ddff4440f6bf8905b5c1ea6d56’ 2022-04-26 14:10:20 DEBUG rasa.core.processor - Received user message ‘stop’ with intent ‘{‘id’: -4315924082343364419, ‘name’: ‘stop’, ‘confidence’: 0.9853187799453735}’ and entities ‘’ 2022-04-26 14:10:20 DEBUG rasa.core.processor - Logged UserUtterance - tracker now has 16 events. 2022-04-26 14:10:20 DEBUG rasa.core.policies.memoization - Current tracker state: [state 1] user intent: greet | previous action name: action_listen [state 2] user intent: greet | previous action name: utter_greet [state 3] user intent: stop | previous action name: action_listen | active loop: {‘name’: ‘cart_roles_form’} 2022-04-26 14:10:20 DEBUG rasa.core.policies.memoization - There is no memorised next action 2022-04-26 14:10:20 DEBUG rasa.core.policies.ted_policy - TED predicted ‘utter_ask_continue’ based on user intent. 2022-04-26 14:10:20 DEBUG rasa.core.policies.rule_policy - Current tracker state: [state 1] user intent: greet | previous action name: action_listen [state 2] user intent: greet | previous action name: utter_greet [state 3] user intent: CART_Roles_and_Authorizations | previous action name: action_listen [state 4] user intent: CART_Roles_and_Authorizations | previous action name: cart_roles_form | active loop: {‘name’: ‘cart_roles_form’} [state 5] user text: stop | previous action name: action_listen | active loop: {‘name’: ‘cart_roles_form’} 2022-04-26 14:10:20 DEBUG rasa.core.policies.rule_policy - There is no applicable rule. 2022-04-26 14:10:20 DEBUG rasa.core.policies.rule_policy - Predicted loop ‘cart_roles_form’. 2022-04-26 14:10:20 DEBUG rasa.core.policies.ensemble - Made prediction using user intent. 2022-04-26 14:10:20 DEBUG rasa.core.policies.ensemble - Added DefinePrevUserUtteredFeaturization(False) event. 2022-04-26 14:10:20 DEBUG rasa.core.policies.ensemble - Predicted next action using policy_2_RulePolicy. 2022-04-26 14:10:20 DEBUG rasa.core.processor - Predicted next action ‘cart_roles_form’ with confidence 1.00. 2022-04-26 14:10:20 DEBUG rasa.core.actions.forms - Validating user input ‘UserUttered(text: stop, intent: stop, use_text_for_featurization: False)’. 2022-04-26 14:10:20 DEBUG rasa.core.actions.forms - Trying to extract requested slot ‘transaction’ … 2022-04-26 14:10:20 DEBUG rasa.core.actions.forms - Got mapping ‘{‘type’: ‘from_text’}’ 2022-04-26 14:10:20 DEBUG rasa.core.actions.forms - Successfully extracted ‘stop’ for requested slot ‘transaction’ 2022-04-26 14:10:20 DEBUG rasa.core.actions.forms - Validating extracted slots: {‘transaction’: ‘stop’} 2022-04-26 14:10:20 DEBUG rasa.core.actions.action - Calling action endpoint to run action ‘validate_cart_roles_form’. 2022-04-26 14:10:20 DEBUG rasa.core.actions.forms - Request next slot ‘transaction’ 2022-04-26 14:10:20 DEBUG rasa.core.processor - Policy prediction ended with events '[<rasa.shared.core.events.DefinePrevUserUtteredFeaturization object at 0x0000024BF83AF610>

got solution. i didn’t mention the domain.yml file for same stop intent .now form interruption is working good.


forms:

  cart_roles_form:

    required_slots:

      transaction:

      - intent_name: None

        not_intent: stop

        type: from_text

followed this discussion.

thanks anca and @ChrisRahme

2 Likes