Hey, thank you very much for your response!
If I understand you correctly, you are talking about “how to set a slot by clicking a button”. However, when I ask for the user name (last name, birthday, customer-id,…) I am not setting a button. The custom form asks the user (“What is you first name?”) and the user types it into the field to set the slot directly.
Please do not understand me wrong. I also have the strong feeling, that setting the slot correclty is the key to the problem. The second option for me is that Rasa has a bug.
Let’s look at the problem more cloosly to make sure that everybody can understand it:
In my domain file I have:
intents:
- name
- name_last
entities:
- name
- name_last
slots:
name:
type: unfeaturized
name_last:
type: unfeaturized
actions:
- utter_ask_name
- utter_ask_name_last
forms:
- authenticate_form
templates:
utter_ask_name:
- text: What is your first name?
buttons:
- title: "FirstName"
payload: "name"
utter_ask_name_last:
- text: What is your last name?
buttons:
- title: "LastName"
payload: "name_last"
This is how I set the slot. As you can see, it looks like creating a button, but the way I set the payload
will not create a button. I have to admit, it was not a smart idea to call every item (intent, entity and slot) by the same name. As far as I checked. this is not the root of the problem.
According to your last post, what is wrong about this? I don’t see what I did wrong!
I am not sure if this is important, but let me explain what else I do:
In the stories.md file I do this:
## story_form_happy_path
- authenticate_form
- form{"name": "authenticate_form"} <!--- start form -->
- slot{"name": "Sam"}
- slot{"name_last": "Johns"}
- form{"name": null} <!--- finish form. This is set when the form has filled all of its required slots -->
Not sure, if this is the correct way, but it seems to work.
Lastly, let me explain my custom form which asks all relevent questions. If you need to collect multiple pieces of information (name, name_last, birthday,…) in a row, Rasa recommends to create a FormAction
. This is a single action which contains the logic to loop over the required slots and ask the user for this information. As far as I understand, this is where I set the slots.
class AuthenticateForm(FormAction):
def name(self):
# type: () -> Text
return "authenticate_form"
@staticmethod
def required_slots(tracker):
# type: () -> List[Text]
return ["name", "name_last", "birthday"]
def submit(self, dispatcher, tracker, domain):
# type: (CollectingDispatcher, Tracker, Dict[Text, Any]) -> List[Dict]
return []
def slot_mappings(self):
# type: () -> Dict[Text: Union[Dict, List[Dict]]]
return {
"name": [self.from_entity(entity="name", not_intent=["chitchat"])],
"name_last": [self.from_entity(entity="name_last", not_intent=["chitchat"])],
"birthday": [self.from_entity(entity="birthday", not_intent=["chitchat"])]
}
def validate(self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict]:
....
# validation succeed, set the slots values to the extracted values
return [SlotSet(slot, value) for slot, value in slot_values.items()]
So, these are all potential error sources that I can think of.
Note: Setting the slots the way I explained above is working! The bot is excatly doing what it is supposed to do. However, each time I set the slot, I get this warning, that I mentioned earlier.