Break long answers into small sentences in rasa

When Rasa answers a question, those answers may contain several lengthy sentences. This can be difficult to read. It would be nice, if we could break these paragraphs up and send the individual sentences to the user, in a delayed manner.

Is there any possible way to that?

From within a custom action, you can call dispatcher.utter_template (or utter_message) multiple times and the user will get multiple messages even though only a single action got executed.

Not sure if we removed this, but I think you can also create multiple messages by using a double newline: "Hey how are you?\n\n I am here to help!".

Hi tmbo , i agree on first point that we can send multiple response using utter_message multiple times but your point of add “\n\n” is not working.

\n\n is adding a new line when send response back to bot but its not splitting the string in actions . Does rasa have any inbuild function which does this functionality.(other approach is also fine)

Which input / output channel are you using?

I am using socketio channel .

ah great - the socketio connector is the only connector which doesn’t have this implemented. Would be great if you can open a feature request on github. If you have a second and want to contribute to the project: this would be a great contribution :wink:

@tmbo Yeah socketio is not support for the new line character specification (\n) into the domain.yml. Could you please provide any alternative for that?

the socket io channel will be fixed and properly splits messages at \n\n after the next release

@tmbo \n\n splits the bot answers throughout separately. I want the line splitting in only one message from the bot.

Hi for bullets use “\n* line1. \n* line2” you will get output as:

  • line1
  • line2

Using \ \n (\double space\n) worked for me.

Example:

utter_message: "Hi! \ \n This is Sid"

Gives the output [in the same message] : -

Hi!

This is Sid

1 Like

Hi @tmbo ,

how about adding a time delay between each of the splitted response ?