Split utterances templates into multiple answers

Hello there,

at the moment I’m starting to learn how to create dialogues with Rasa Core and one thing I couldn’t find in the documentation or anywhere else is how to define multiple agents answers. I don’t mean variations, I want to present answers in multiple speech bubbles to present the content in smaller bits.

Does anyone have an idea for that?

Best from Berlin, Marco :slight_smile:

1 Like

You can do something like,

In stories.md file,

Story: smalltalk.greetings.hello

  • smalltalk.greetings.hello
    • utter_greetings.hello # Message : Hello
    • utter_greetings.help # Message : How can I help you today?

In your custom action file,

def run (...)
    return [...]
1 Like

oh cool, thanks for the fast answer. I’ll try that later :slight_smile:

You can also combine utterances of different types such as:

  • greetings.hello
  • utter_greetings.hello
  • action_custom_action

However, these messages will be pushed to the channel within miliseconds. So I tend to add some wait times. E.g. you could do this:

  • greetings.hello
  • utter_greetings.hello
  • action_sleep
  • action_custom_action

With action_sleep looking something like:

    class ActionSleep(Action):
	    def name(self):
		    # type: () -> Text
		    return "action_sleep"

        def run(self, dispatcher, tracker, domain):
	        # type: (Dispatcher, DialogueStateTracker, Domain) -> List[Event]
	        return []

Not sure if there’s a better way though to make the bot pause in between multiple messages.


Hi, I’m receiving in the debug two answers from the Bot, but I don’t know how can I print both of them, because I’m getting only the first:

DEBUG:rasa_core.processor:Predicted next action 'utter_siniestro_auto' with prob 0.81.
DEBUG:rasa_core.processor:Action 'utter_siniestro_auto' ended with events '[]'
DEBUG:rasa_core.processor:Bot utterance 'BotUttered(text: le pasamos con siniestro de automóvil, data: {
  "elements": null,
  "buttons": null,
  "attachment": null
DEBUG:rasa_core.policies.ensemble:Predicted next action using policy_0_KerasPolicy
DEBUG:rasa_core.processor:Predicted next action 'utter_init' with prob 0.94.
DEBUG:rasa_core.processor:Action 'utter_init' ended with events '[]'
DEBUG:rasa_core.processor:Bot utterance 'BotUttered(text: bienvenido a seguros, qué desea?, data: {
  "elements": null,
  "buttons": null,
  "attachment": null

but then when I do:

    body = json.dumps({ "message": sentence, "uuid": "{}".format(user_id) })
    r = requests.post("http://localhost:5002/webhooks/botHttpServer/chat/Robbie/{}/ask".format(user_id), data=body)
    answer = json.loads(r.text)['response']
    slots = json.loads(r.text)

I only get the first answer. Any help?


Hi @kothiyayogesh,

to have a sequence of multiple answers, i just tested that’s sufficient to have a story that reply to an intent with a sequence of utterances, as you showed in your example.

But, apparently there is need to have a custom action. I’m wrong?

BTW, because this thread is old, there is better solution in RASA now?

Thanks giorgio