Create selection index for any menu in rasa

Hello Guys,

I want to create multiple menus asking for different services which will be selected by a user with the number on it

for eg. both asks: Please choose one of the following options to search

  1. Supermarkets
  2. Restaurants
  3. Spa & Salons

and the user can say: either “Supermarkets” or 1 to select

this can be implemented with creating an intent but that will be only applicable for a single menu, i want to create multiple menus

how can I implement this?

@MuraliChandran14, @may, @alexweidauer, @flore. @mohan, @samscudder you guys may help me in this case

Hello @omkarcpatil

Why would using intents be only applicable to a single menu? You mean if the user replies with a number then this would correspond to an intent linked to the first menu, but not any other? I would just not use the numbers to define the intents. Instead, I’d define a form where the primary method of selection is by intent, and a secondary is by an entity number. See Forms.

hello @j.mosig,

thanks for the link

with that still not getting it properly. i think i have made some sytax error or something.

my bot is asking for confirmation on deregistration,

Are you sure you want to deregister ?

1.yes

2.no

inside a form i have kept my slot_mappings in following way

{“deregister_confirmation”: [self.from_entity(intent=“affirm”, entity= “number” , value=“yes”), self.from_entiry(intent=“deny”, entity= “number”, value=“no”)]}

no luck with this getting error: Failed to extract slot deregister_confirmation with action actions_deregister

i even tried doing this:

return {“deregister_confirmation”: [self.from_intent(intent=“affirm”, value=“yes”), self.from_intent(intent=“deny”, value=“no”), self.from_entity(entity = “number”)]}

I see a typo there. Might that be it?

@omkarcpatil Hi!

I do not understand this:

{“deregister_confirmation”: [self.from_entity(intent=“affirm”, entity= “number” , value=“yes”), self.from_entiry(intent=“deny”, entity= “number”, value=“no”)]} Have you got numbers to extract in the intent “affirm” or “deny” ?

In my case I prefer that the user choose the options with words. But this is interesting:

I’m thinking about how correlate the number with the option. Tell me how you do this!

@flore, yes i have intent valled as number

at the end following worked for me:

def slot_mappings(self) -> Dict[Text, Any]:
  
    return {
        "deregister_confirmation": [self.from_text(intent=["affirm","number"]),
                                    self.from_text(intent=["deny","number"])]
    }


def validate_deregister_confirmation(
        self,
        value: Text,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
) -> Dict[Text, Any]:

    intent_name = tracker.latest_message["intent"]["name"]

    if (value == "1" or intent_name == "affirm"):
        return {"deregister_confirmation": "yes"}
    elif (value == "2" or intent_name == "deny"):
        return {"deregister_confirmation": "no"}
    else:
        return {"deregister_confirmation": None}
2 Likes

How do you do to implement those actions?