Or statement with slot_was_set

I am using RulePolicy and MemoizationPolicy.

I have two slots ‘country’ and ‘city’ with influence_conversation: true

I am updating their values in a custom-action ‘action_change_address’

The story goes like this:

  • story: main steps:
    • intent: greet
    • action: utter_greet
    • action: action_change_address
    • or:
      • slot_was_set:
        • country: germany
        • city: berlin
      • slot_was_set:
        • country: UK
        • city: london
    • action: utter_about

I want the bot to utter ‘about’ if the custom action sets country and city slots to either UK, london or germany,berlin. Therefore I am using ‘OR’ statement.

However the bot runs ‘action_default_fallback’. Can anyone guide me? It says there is no memorized next action and no applicable rule.

Custom action:

class ActionChangeAddress(Action):

    def name(self) -> Text:

        return "action_change_address"

    def run(self, dispatcher: CollectingDispatcher,

            tracker: Tracker,

            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        dispatcher.utter_message(text="Hello World!")

        return [SlotSet(key = 'country',value = 'UK' ), SlotSet(key = 'city',value = 'london' )]

I suggest building this story using Interactive Learning on Rasa X :slight_smile:

I want the bot to utter ‘about’ if the custom action sets country and city slots to either UK, london or germany,berlin. Therefore I am using ‘OR’ statement.

Do not know how to do this in Interactive Learning on Rasa X

Please learn about interactive learning in Rasa Shell and Rasa X. It really helps a lot.

How to use interactive learning on custom action? I can’t change the slot values being set and I need a way to create stories for both {UK,London} and {Germany, Berlin}

There isn’t much in the documentation about it. I know how to run the shell and interact with the bot but not for this particular usecase.

I know the custom action implemented right now is static but what if it was dynamic and the values could change?

Just want to know how to use OR statement with multiple slots? It works fine with a single slot! And the documentation also only states an example which uses one slot updating in a custom_action.

You can’t change the custom action.

But as I understand, your story is fine until utter_about, so use interactive learning, and when action_change_address gets executed, you tell it to execute utter_about next.

It is not recommended to use many OR statements. There surely is a better way of doing this.

Why not use the FollowupAction() event inside the action?

How exactly will that help? I don’t think it’ll solve my problem. Can you recommend something else?

I just have to join multiple stories into one after a custom_action that is setting more than one slot value

My task is to basically set multiple slot values in a custom_action.

But the documentation says if any custom_action is setting a slot, I should add the slot event in the story right after custom_action call using slot_was_set. The example available explains how to do this using only one slot.

Slot_was_set:

  • slot:value

My problem is that the custom_action will fill the slot in runtime so I do not know the ‘value’ to put under slot_was_set while writing the story. This is the reason I was trying to use OR statement. So that I can put all possible values of ‘value’ under the custom_action call in the story.