# How to train for slot\_was\_set by custom action correctly?

**URL:** <https://forum.rasa.com/t/how-to-train-for-slot-was-set-by-custom-action-correctly/55418>\
**Category:** Rasa Open Source\
**Created:** [September 20, 2022, 12:44pm UTC](https://forum.rasa.com/t/how-to-train-for-slot-was-set-by-custom-action-correctly/55418 "2022-09-20T12:44:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MelT](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/melt/32/21530_2.png) [@MelT](https://forum.rasa.com/u/MelT)\
**Post date:** [September 20, 2022, 12:44pm UTC](https://forum.rasa.com/t/how-to-train-for-slot-was-set-by-custom-action-correctly/55418/1 "2022-09-20T12:44:47Z")

</div>

Hi all,

I’m setting several slots in custom actions and now I have a couple of questions for which I cannot find an answer. (The next action is a conditional response so I can set the influence\_conversation parameter to false as the action will be the same for every value.)

This is my story:

```auto
- story: happy path intro 
  steps:
  - intent: interested_in_veg_food
  - action: utter_ask_ready_for_a_question
  - intent: affirm
  - action: action_reset_veg_food_slot # will change the values of the slot
  - action: action_ask_veg_food
  - intent: rate_veg_food # how often they eat it (e.g. never, sometimes, often)
  - action: action_set_veg_food # custom action that sets the value
  - action: utter_conditional_response
  - action: action_set_heard_explanation # sets a slot for later
  - intent: affirm
  - action: utter_conditional_advice
  - intent: affirm
  - action: utter_final_message

```

> 1. Do I always need to train for slot\_was\_set in stories when this was done by custom actions (e.g. in the example above “action\_set\_veg\_food”)? If I don’t do so how will it affect the policies? Or do I **only** need for **slot\_was\_set** within a story when **influence\_conversation** is set to **true**?

> 1. When a slot has several values (e.g. a categorical slot) but no matter with which value the slot will be set it will in each case continue with the same action (in my case a conditional response). Do I need to train the story with an OR statement for each value of the categorical slot and should the “influence conversation” be set to be false?

To me, the documentation is a bit ambiguous. [Here](https://rasa.com/docs/rasa/stories#slot-events) it says

> _“Slot events are written under `slot_was_set` in a story. If this slot is set inside a custom action, add the `slot_was_set` event immediately following the custom action call.”_

That kind of implies that we **need** to train it in a story. (also this rasa example [here](https://github.com/RasaHQ/rasa/blob/main/examples/concertbot/data/stories.yml) does train every slot in the conversation even when **influence conversation** is set to false. However, [here](https://rasa.com/docs/rasa/writing-stories/#when-to-use-slots-to-influence-conversations) it says

> _“Slots can be set after every user message based on [slot mappings](https://rasa.com/docs/rasa/domain#slot-mappings). They can also be set by a [custom action](https://rasa.com/docs/rasa/actions) run in response to a user message. All slots which influence the conversation need to be added to your stories or rules.”_

which implies that it does **not** to be trained if **influence conversation** is set to false.

My “problem” is that I have a lot of slots set that get values defined by custom action, e.g. I store a value of slot **example\_slot** in slot **example\_slot\_old** when resetting **example\_slot** so it will be impossible for me to train all these different slot events within a story. Further having many values for the categorical slot will lead to massive OR statements for the slot\_was\_set event which will increase training a lot… Basically, I would love to know in which cases exactly I **NEED** to train for slot\_was\_set to not reduce the performance.

Please someone help me with that 🙋‍♂️ I would appreciate it a lot ❤

@mloubser
