Slot filling feature is not working

Hi, I have a custom action file which contains a FormAction and added the necessary intents for that custom Form action. Now I have few questions here.

  1. Should I update all the files ( and domain.yml) manually?
  2. If not, how can I generate the stories with slots using interactive learning feature for the FormAction, which is written in a custom action file?
  3. Is it mandatory to add the validate method for the FormAction?

Even I tried the interactive learning after updating the domain.yml manually. But, the stories with slots (with prefix form:) is not generating automatically. Am I missing any part for slot filling feature?

package versions:

rasa-core==0.13.7 rasa-core-sdk==0.12.2 rasa-nlu==0.14.6

Here is my code in action file.

class CheckPerformanceIssueForm(FormAction):
    def name(self) -> Text:
        return "check_performance_issue"

    def required_slots(tracker: Tracker) -> List[Text]:
        return ["exp_resp_time", "cur_resp_time"]

    def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
        return {
            "exp_resp_time": self.from_entity(entity="exp_resp_time", intent="inform"),
            "cur_resp_time": self.from_entity(entity="cur_resp_time", intent="inform"),

    def submit(
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
    ) -> List[Dict]:
        dispatcher.utter_template("utter_submit", tracker)
        return []

Also, I am getting the following error when the user type the questions: 2019-04-22 11:46:27 ERROR main - Failed to validate slot cur_resp_time with action check_performance_issue

Please help.

Thank you in adv.

Ans 1- Yes, i think you should update your domain files manually. Adding forms sections in the domain file. Although for stories you can use interactive learning

Ans 3- No, It is not mandatory.

Thanks @kamlesh for the reply.

In my case, I created a custom action file with FormAction in it and updated domain.yml for adding the form section. Then I tried the interactive learning, but could not see any interaction with “form:” prefix. It generates the story as just as the normal story and there are no story created with any “form:” prefix. Please tell me, if need to do anything specifically for this?

Thank you,

See apart from adding the form in the domain file and writing the Action for it make sure to check the below things.

  1. You are using the forms to fill some slots - For that you need to write four functions in the form action given on this link.

2 In the function slot mapping you can decide how to fill the slot - like from entity, intents or from free text.

3 Most important if you are adding it from a free text, i.e from user input text you need to add the following lines in the domain file in the templates sections. Rasa framework will utter these lines if the slot is not filled from the intents and entity.


- text: The question you want to ask to fill the slot?

I can see you have added the 4 functions and are you sure your slots are filled with the entity, you can add from text also, in that case rasa will utter the template to fill the slot . And make sure you have added the forms in the story too where you want to invoke it. For any doubt let me know.

Thanks @kamlesh for the great explanation. That really helps.

I am confirming here that I get the slot values after modifying the slot mapping function and replace the entity with self.from_text(). So, now my slot_mappings() function returns

return {
            "exp_resp_time": [self.from_text()],
            "cur_resp_time": [self.from_text()],

Also, I modified the domain slots values as:

    type: text
    type: text

This works fine for me. But, I would like to know few things along with this.

  1. I would like to fill the slots from the entities that are defined in an intent called “inform”. Could you please tell me how can I achieve it?

Please find the sample values added to the intent “inform” in my file

## intent:inform
- The expected response time is [two](exp_resp_time:2) seconds
- Expected is [three](exp_resp_time:3) sec
- I believe the expected response is [four](exp_resp_time:4) sec
- The expected could be [five](exp_resp_time:5)
- The curent could be [ten](cur_resp_time:10)
- I believe the expected response is [nine](cur_resp_time:9) sec
- Current response time is [eight](cur_resp_time:8) seconds
- The current response time is [seven](exp_resp_time:7) seconds
  1. Please provide more details on the comment which you added " And make sure you have added the forms in the story too where you want to invoke it".

  2. Do we need to add the forms manually to each stories?

  3. Format for adding forms for each stories will be the same?

Please advise.

Thank you,

First thing read this blog

I can see you have given type text to your slots, please go through the above article and see if it is right choice for you, as some time “text” type can hinder the story flow. Read more about it on here .

Ans 1 Yes you can fill the slots with entities - For that your training data need to be labeled for entities. For labeling the data you can use some UI tool to make the training data[also it can be manually done ], its given on rasa git-hub page. And read about this link. You will see some text in blue this is tagging of data, telling what is what to rasa framework.

Ans 2 -I mean you have to invoke forms in your story if you are using them i.e they have to be part of the story, above link will give you some idea.

Ans 3 -Yes we need to add the form in stories. This is related to second point, so read the above blog. Ans 4- Yes the format is same.

Thank you very much @kamlesh . Will check the blog and come back to you, if I still have more questions.

Thank you,