# Value-based Responses

**URL:** <https://forum.rasa.com/t/value-based-responses/33881>\
**Category:** Rasa Open Source\
**Created:** [September 17, 2020, 2:47pm UTC](https://forum.rasa.com/t/value-based-responses/33881 "2020-09-17T14:47:56Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![haya](https://avatars.discourse-cdn.com/v4/letter/h/db5fbb/32.png) [@haya](https://forum.rasa.com/u/haya)\
**Post date:** [September 17, 2020, 2:47pm UTC](https://forum.rasa.com/t/value-based-responses/33881/1 "2020-09-17T14:47:56Z")

</div>

Hi All,

Is it possible to have multiple texts based on slot value for the same response like:

responses:

utter\_greet:

- text: I’m human

- text: I’m bot

Thank you!

---

<div class="post-metadata">

**Author:** ![j.mosig](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/j.mosig/32/3588_2.png) [@j.mosig](https://forum.rasa.com/u/j.mosig)\
**Post date:** [September 17, 2020, 3:34pm UTC](https://forum.rasa.com/t/value-based-responses/33881/2 "2020-09-17T15:34:49Z")

</div>

Hi @haya

What exactly do you mean? Do you want you assistant to randomly select between multiple response templates? Or do you want the assistant to send multiple messages in a row?

---

<div class="post-metadata">

**Author:** ![haya](https://avatars.discourse-cdn.com/v4/letter/h/db5fbb/32.png) [@haya](https://forum.rasa.com/u/haya)\
**Post date:** [September 17, 2020, 4:19pm UTC](https://forum.rasa.com/t/value-based-responses/33881/3 "2020-09-17T16:19:22Z")

</div>

Hi @j.mosig, Thanks for your reply.

I want the assistant to choose from list of responses based on a specific slot value.

for example if I have a slot “style\_slot” with value “bot\_style” the assistant should choose the response “I’m bot” from the utter\_greet template that contains another responses

---

<div class="post-metadata">

**Author:** ![j.mosig](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/j.mosig/32/3588_2.png) [@j.mosig](https://forum.rasa.com/u/j.mosig)\
**Post date:** [September 18, 2020, 1:52pm UTC](https://forum.rasa.com/t/value-based-responses/33881/4 "2020-09-18T13:52:21Z")

</div>

One way of doing this is to implement a custom action that checks the slot value and returns the appropriate message via the dispatcher. See [Custom Actions | Rasa Open Source Documentation](https://rasa.com/docs/rasa/custom-actions) (or [Rasa SDK](https://legacy-docs-v1.rasa.com/api/rasa-sdk/#actions) if you’re not on Rasa 2.0 yet)

You might also be interested in the response selector component.

---

<div class="post-metadata">

**Author:** ![j.mosig](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/j.mosig/32/3588_2.png) [@j.mosig](https://forum.rasa.com/u/j.mosig)\
**Post date:** [September 18, 2020, 1:54pm UTC](https://forum.rasa.com/t/value-based-responses/33881/5 "2020-09-18T13:54:31Z")

</div>

You can also have rasa learn which action is the right one, given the slot value. For that, you have to featurize the slot, e.g. as a categorical slot, and have one action for each response and some stories for each case. This approach is more flexible but might be error prone, especially if you don’t have much training data to go with. In Rasa 2.0 you can use rules for that, though.

---

<div class="post-metadata">

**Author:** ![haya](https://avatars.discourse-cdn.com/v4/letter/h/db5fbb/32.png) [@haya](https://forum.rasa.com/u/haya)\
**Post date:** [September 20, 2020, 6:56am UTC](https://forum.rasa.com/t/value-based-responses/33881/6 "2020-09-20T06:56:51Z")

</div>

Thanks again @j.mosig!

I wanted to go with the custom actions solution but what stopped me was the utterance messages of forms, but I figured out that I can customize the request\_next\_slot method and check the slot value first then choose the response based on it.
