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
style_slot: “bot_style” ( a slot set as bot_style)
Thank you!
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
style_slot: “bot_style” ( a slot set as bot_style)
Thank you!
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?
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
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 (or Rasa SDK if you’re not on Rasa 2.0 yet)
You might also be interested in the response selector component.
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.
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.