I added a form to my rasa bot. The rasa bot works well without the form but on adding the form I get the error "Failed to extract slot SEARCH_NAME with action form_search_scholarship". I do not know what I am missing as I have tried different variation.
domain.yml
...
entities:
- SEARCH_NAME
- SEARCH_KEYWORD
slots:
SEARCH_KEYWORD:
type: text
SEARCH_NAME:
type: text
...
stories.yml
## keyword search path
* menu
- utter_menu
* search_scholarship
- utter_search
* keyword_search_scholarship
- form_search_keyword
- form{"name": "form_search_keyword"}
- form{"name": null}
## scholarship name search path
* menu
- utter_menu
* search_scholarship
- utter_search
* scholarship_name_search
- form_search_scholarship
- form{"name": "form_search_scholarship"}
- form{"name": null}
actions.py
class ActionFormSearchKeyword(FormAction):
def name(self) -> Text:
"""Unique identifier of the form"""
return "form_search_keyword"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
"""A list of required slots that the form has to fill"""
return ["SEARCH_KEYWORD", ]
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_message(template="utter_search_found", search_result=tracker.get_slot('SEARCH_KEYWORD'),
search=tracker.get_slot('SEARCH_KEYWORD'))
# # utter submit template
# dispatcher.utter_message(template="utter_search_not_found", search_result=tracker.get_slot('SEARCH_KEYWORD'),
# search=tracker.get_slot('SEARCH_KEYWORD'))
return []
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
"""A dictionary to map required slots to
- an extracted entity
- intent: value pairs
- a whole message
or a list of them, where a first match will be picked"""
return {
"search_result": [self.from_entity(entity="SEARCH_KEYWORD"),
self.from_text()],
}
It's hard to say what the exact problem is (it would help to see the form_search_scholarship action code since that's where the error is coming from) but my guess is that you might not be correctly extracting the name entity from the input text. That tends to be the most common reason you'll see this error.
To troubleshoot this, I would:
rasa nlu
in the command line and input the turn the assistant is failing on. See if the intended entity is extracted correctly