# Slot is getting filled with chitchat

**URL:** <https://forum.rasa.com/t/slot-is-getting-filled-with-chitchat/6190>\
**Category:** Rasa Open Source\
**Created:** [March 20, 2019, 12:33pm UTC](https://forum.rasa.com/t/slot-is-getting-filled-with-chitchat/6190 "2019-03-20T12:33:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chatbot\_Ra](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/chatbot_ra/32/2238_2.png) [@Chatbot\_Ra](https://forum.rasa.com/u/Chatbot_Ra)\
**Post date:** [March 20, 2019, 12:33pm UTC](https://forum.rasa.com/t/slot-is-getting-filled-with-chitchat/6190/1 "2019-03-20T12:33:33Z")

</div>

**Rasa Core version** : 0.13.2

**Python version** : 3.6.8

**Operating system** (windows, osx, …): Windows

**Issue** : My chitchat does not work correctly. The main goal of my chatbot is to fill the required slots (name, birthday, product type and customer number). In between the slot filling process, it is possible that the customer is writing chitchat. Therefore I need a story that can handle this case. However, this doesn’t work properly. When writing chitchat, it is populating my slots.

**Possible reasons:** The story “story\_form\_unhappy\_path” doesn’t work. According to [Slot Filling](https://rasa.com/docs/core/slotfilling/#section-unhappy) I need an ActionExecutionRejection (not included in the example because it is not working) in the actions.py file (usualy in the validation function). See here: [rasa\_core/actions.py at master · RasaHQ/rasa\_core · GitHub](https://github.com/RasaHQ/rasa_core/blob/master/examples/formbot/actions.py)

**My question:** Can you please tell me what is going wrong in my code? How can I stop chitchat from populating my slots?

**My code:**

stories.md

```auto
## story_greet_happy_path 
* greet
 - utter_introduction
 - utter_education  
> check_education <!--- setting a checkpoint -->

## story_form_happy_path
> check_education
 - authenticate_form
 - form{"name": "authenticate_form"} <!--- start form --> 
 - slot{"name": "Sam Johns"} <!--- asking for name --> 
 - slot{"product": "credit"} <!--- asking to choose a button --> 
 - slot{"birthday": "01.01.1979"} <!--- asking for birthday --> 
 - slot{"contract_no": "123457890"} <!--- asking for contract number --> 
 - form{"name": null} <!--- finish form --> 
 > check_summary

## story_form_unhappy_path
> check_education
 - authenticate_form
 - form{"name": "authenticate_form"} <!--- start form -->  
 * chitchat
 - utter_chitchat
 - slot{"name": "Sam Johns"} <!--- asking for name --> 
 - slot{"product": "credit"} <!--- asking to choose a button --> 
 - slot{"birthday": "01.01.1979"} <!--- asking for birthday --> 
 - slot{"contract_no": "123457890"} <!--- asking for contract number --> 
 - form{"name": null} <!--- finish form --> 
 > check_summary

## story_summary
> check_summary
 - utter_summary_name
 - utter_summary_birthday
 - utter_summary_contract_no

## story_bye
* bye
 - utter_bye

```

train.md

```auto
## intent:bye 
- by
- see you
- goodby

## intent:greet
- hi
- good morning
- hello

## intent:thank
- thanks
- thank you
- thank you very much

## intent: chitchat
- how is the weather?
- how old are you?
- you are stupid!

## intent:contract_no
- [1234567890](contract_no)
- this is my contract numer [0987654321](contract_no)
- here is my contract number [0987654321](contract_no)

```

domain.yml

```auto
intents:
- greet
- bye
- thank
- chitchat
- contract_no

entities:
- name
- product
- birthday
- contract_no

slots:
  name:
    type: unfeaturized
  product:
    type: categorical
    values:
      - credit
      - account
  birthday:
    type: unfeaturized
  contract_no:
    type: unfeaturized

actions:
- utter_ask_name
- utter_ask_birthday
- utter_ask_contract_no
- utter_thank
- utter_bye
- utter_form_bye
- utter_introduction
- utter_education
- action_default_fallback
- utter_summary_name
- utter_summary_birthday
- utter_summary_contract_no
- utter_chitchat

forms:
  - authenticate_form

templates:

  utter_introduction:
  - text: "Hi I am your chatbot" 

  utter_education:
  - text: "I need some informations about you."

  utter_ask_name:
   - text: "What is your name (first and last name)?" 
     buttons:
     - title: "first Nachname"
       payload: "name"

  utter_ask_birthday:
  - text: "Was ist Ihr Geburtsdatum?"
    buttons:
    - title: "tt.mm.jjjj"
      payload: "birthday"

  utter_ask_product:
  - text: "Um welches Produkt geht es?"
    buttons:
    - title: "Kredit"
      payload: '/product{"product": "credit"}'
    - title: "Konto"
      payload: '/product{"product": "account"}'

  utter_ask_contract_no:
  - text: "What is your contract number?"
    buttons:
    - title: "0123456789"
      payload: "contract_no"  

  utter_bye:
  - text: "Thank you {name}. I will forward you to an {product} expert"

  utter_form_bye:
  - text: "Thank you for providing your informations"

  utter_summary_name:
  - text: "Your name: {name}"  

  utter_summary_birthday:
  - text: "Your birthday: {birthday}"    

  utter_summary_contract_no:
  - text: "Your contract number: {contract_no}" 
  
  utter_thank:
  - text: "You are welcome"

  utter_chitchat:
  - text: "Sorry, I do not speak chitchat."  

```

actions.py

```auto
from rasa_core_sdk.forms import FormAction

class AuthenticateForm(FormAction):
    """Example of a custom form action"""

    def name(self):
        # type: () -> Text
        """Unique identifier of the form"""
 
        return "authenticate_form"
 
    @staticmethod
    def required_slots(tracker):
        # type: () -> List[Text]
        """A list of required slots that the form has to fill"""
 
        return ["name", "product", "birthday",
                "contract_no"]
 
    def submit(self, dispatcher, tracker, domain):
        # type: (CollectingDispatcher, Tracker, 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_form_bye', tracker)
        return []

    def slot_mappings(self):
        # type: () -> 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 {
                "name": [self.from_entity(entity="name")],
                "product": [self.from_entity(entity="product")],
                "birthday": [self.from_entity(entity="birthday")],
                "contract_no": [self.from_entity(entity="contract_no")],
                }

```

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [April 4, 2019, 3:17pm UTC](https://forum.rasa.com/t/slot-is-getting-filled-with-chitchat/6190/2 "2019-04-04T15:17:01Z")

</div>

@Chatbot_Ra did you modify the validate() function? Because it should be there by default and it does work for chitchat

---

<div class="post-metadata">

**Author:** ![enzechua](https://avatars.discourse-cdn.com/v4/letter/e/ad7895/32.png) [@enzechua](https://forum.rasa.com/u/enzechua)\
**Post date:** [July 27, 2019, 12:14pm UTC](https://forum.rasa.com/t/slot-is-getting-filled-with-chitchat/6190/3 "2019-07-27T12:14:02Z")

</div>

Hi @akelad I realise that when I commented out my validate function, the bot was able to detect the stop intent and go to the path -\> “Do you want to continue” but with my validate function on, it does not detect this path. Hmm maybe I am missing out on my validate function or something…?

---

<div class="post-metadata">

**Author:** ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)\
**Post date:** [August 16, 2019, 9:50am UTC](https://forum.rasa.com/t/slot-is-getting-filled-with-chitchat/6190/4 "2019-08-16T09:50:12Z")

</div>

did you customise your validate function?
