Action_default_fallback is invoked even I have a custom action in my story

I am following youtube videos on Rasa open source. I wanted to set my slot using custom action and then retrieve it again by a custom action. Slot is setting correctly but the next action which is to retrieve slot value is overridden by action_default_fallback.

NLU.yml

- intent: tell_name

examples: | - I want to tell you my name. - give name - do you know my name? - i’ll give you my name.

  • intent: repeat_name examples: |

    • what is my name
    • tell me my name
    • do you know my name
    • repeat my name
  • intent: give_name examples: |

    • Rajat
    • Vincent
    • Anand
    • Rahul
    • Ashish

STORY.yml

  • story: name path steps:
    • intent: greet
    • action: utter_greet
    • intent: tell_name
    • action: utter_ask_name
    • intent: give_name
    • action: action_receive_name
    • intent: repeat_name
    • action: action_say_name

DOMAIN.yml version: “2.0”

intents:

  • greet
  • goodbye
  • affirm
  • deny
  • mood_great
  • mood_unhappy
  • bot_challenge
  • tell_name
  • give_name
  • repeat_name

entities: []

slots: name: type: text

actions:

  • action_receive_name
  • action_say_name

responses: utter_greet:

  • text: “Hey! How are you?”

utter_cheer_up:

utter_did_that_help:

  • text: “Did that help you?”

utter_happy:

  • text: “Great, carry on!”

utter_goodbye:

  • text: “Bye”

utter_iamabot:

  • text: “I am a bot, powered by Rasa.”

utter_ask_name:

  • text: “What is your name?”

session_config: session_expiration_time: 60 carry_over_slots_to_new_session: true

actions.py

from typing import Any, Text, Dict, List

from rasa_sdk.events import SlotSet from rasa_sdk import Action, Tracker from rasa_sdk.executor import CollectingDispatcher

class ActionReceiveName(Action):

def name(self) -> Text:
    return "action_receive_name"

def run(self, dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
    text = tracker.latest_message['text']
    print("this action class is working")
    dispatcher.utter_message(text=f"I will remember your name : {text}")

    return [SlotSet("name", text)]

class ActionSayName(Action):

def name(self) -> Text:
    return "action_say_name"

def run(self, dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
    name = tracker.get_slot("name")
    print("rajat"+"  "+name)
    if not name:
        dispatcher.utter_message(text="I don't know your name :(")
    else:
        dispatcher.utter_message(text=f"Your name is {name}!")
    return []

Instead of getting name from second custom action, I am getting “You input” prompt.

Hi @Rajat. The action_default_fallback is usually triggered when you’re saying an utterance that does not have enough confidence. It shouldn’t remove any slot-values though, so I’m curious what exactly happened in the conversation. Glancing at your custom actions, I’d say your code looks good.

Could you share a snippet of the conversation from a rasa interactive session? That way we want see the confidence levels, as well as the slots that have been set in a conversation.

Hi @koaning , I did that and surprisingly that did resolve the issue, I ran rasa interactive and chose the correct action that has to be executed and it made a slight change in stories.yml by adding slot_was_set tag

  • action: action_receive_name
    • slot_was_set:
      • name: rajat

After this assistant worked as desired. I assume that’s the correct solution.

Looks like it!

The nice thing about rasa interactive is that it will properly set slots in your stories on your behalf when you correct it. That is why I always recommend using it early since it also acts as a linter of sorts.