I’m almost new in rasa, and now I want to get some data from the user. I understood I have to use rasa form and read the documentation but can’t understand it and form won’t work! I wanted to get username and password.
here is what I did:
I added this code to my actions file:
class Authentication(FormAction):
"""Example of a custom form action"""
def name(self) -> Text:
"""Unique identifier of the form"""
return "authentications_form"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
"""A list of required slots that the form has to fill"""
return ["username", "password"]
def submit(
self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> List[Dict]:
"""Define what the form has to do
after all required slots are filled"""
# utter submit template
dispatcher.utter_template("utter_submit", tracker)
return []
and finally I added some example of calling form to NLU file.now when I start rasa and ask for authentication, rasa will call the form but what’s the next step? how should I get data?
I send rasa : authenticated me, and rasa will understand it but when I send my username and password after that rasa use fallback policy.
how should get slots?
did you annotate your username and password as entities? Otherwise you should use from_text slot mapping. See docs and linked tutorial there for details: Forms
I looked for “utter_ask_num_people” one of the required slots that rasa ask for, but it is nowhere in the tutorial and “form bot” example codes! (except in domain file that it is where it has been defined but it’s not used anywhere while the image shows it’s working! how?!) tutorial and codes are not complete, can you give me a complete tutorial for how to use rasa form?
Hey, @Ghostvv can you please help me with custom actions. Actually when I train everything goes well but the rasa is not catching the proper response. Commands which are given in rasa docs, I’m using that only so there is not an issue with commands and the terminal. Please check the files and the screenshot for the reference.
actions.py (1.1 KB) domain.yml (686 Bytes) nlu.md (1.9 KB) stories.md (95 Bytes)