Slot is not resetting even after the submit action
See original GitHub issueRasa version: rasa-core==0.13.7 and rasa-core==0.14.1 Python version: Python 3.6.7
Operating system (windows, osx, …): Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic
Issue: Slot is not resetting even after the submit action, when using FormAction
Steps to reproduce the issue:
- Add a new FormAction for a single slot
- Try to ask a question without the slot value present in the user input. The utter_ask action performs and the slot filling questions is asked correctly.
- Try to ask the same question again.
Expected result:
- It should perform the utter_ask action for asking the slot value again, since the slot value is not present in the user input.
Actual result:
- It does not perform the utter_ask action for the missing slot. It uses the slot value, which was set for the previous scenario. This is wrong.
Please note that the slot is resetting correctly, if the user asks some other questions in between and then come back and ask the slot related question again. Please see the sample scenario below to understand the issue correctly.
Sample scenario:- User:> Could you please send me the sever url? Bot:> Please confirm the environment? (Dev or Stg) User:> dev Bot:> The user has asked ‘dev’ environment
User:> hello User:> Hello, how can I help?
User:> Could you please send me the sever url? Bot:> Please confirm the environment? (Dev or Stg) User:> dev Bot:> The user has asked ‘dev’ environment
User:> Could you please send me the sever url? Bot:> The user has asked ‘dev’ environment
Content of configuration file (config.yml):
language: "en"
pipeline:
- name: "nlp_spacy" # loads the spacy language model
- name: "tokenizer_spacy" # splits the sentence into tokens
- name: "ner_crf" # uses the pretrained spacy NER model
- name: "intent_featurizer_spacy" # transform the sentence into a vector representation
- name: "intent_classifier_sklearn" # uses the vector representation to classify using SVM
- name: "ner_synonyms" # trains the synonyms
Content of domain file (domain.yml) (if used & relevant):
forms:
- action_server_url
entities:
- environment
slots:
environment:
type: unfeaturized
auto_fill: false
Content of stories file (stories.md):
## server url happy path
* request_server_url{"url": "url", "server": "server", "dev": "environment"}
- action_server_url
- form{"name": "action_server_url"}
- form{"name": null}
Content of actions.py file (actions.py):
class ServerUrlRequestForm(FormAction):
def name(self) -> Text:
return "action_server_url"
@staticmethod
def required_slots(tracker: Tracker) -> List[Text]:
return ["environment"]
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
return {
"environment": [self.from_text()],
}
def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
return {
"environment": [self.from_entity(entity="environment", intent='inform')]
}
def submit(
self,
dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any],
) -> List[Dict]:
environment = tracker.get_slot('environment')
dispatcher.utter_message("The user has asked '{}' environment" . format(environment))
return []
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top GitHub Comments
Thank you @Ghostvv for sharing your suggestion. That make sense. It works as expected, if we reset the slot manually in submit action. Hence, closing this ticket.
do we need to keep those value even after the submit action
- it is very much dependent on a use case, therefore reseting slots should be done manually in your customsubmit
method.the same impact as resetting the slot automatically.
- impact is the samethe bot behavior depends on what you want to achieve, if you want to ask the question again return
[SlotSet(slot_name, None)]
in your submit method