0

I would like to use RASA Response Selectors for a QnA system where answers are multiline texts, not just single lines. Say a FAQ system allowing answers are paragraphs of documents.

Take this Q/A example, where question is one-line:

 How to follow people on Twitter?

and the corresponding answer (real example from twitter FAQ) is a paragraph:

 1. Find a Tweet from the account you’d like to follow. 
 2. Hover your mouse over their name.
 3. Click the  **Follow**  button.

 OR 

 1. Navigate to a Tweet from the account you’d like to follow. 
 2. Tap the  icon located at the top of the Tweet.
 3. Tap  **Follow**  from the selection menu.

How can I manage this composite / multi line answer with data/responses.md Response Selector markdown format?

As far as I undersatnd (please tell me I'm wrong) now in RASA I can just have 1 line for the answer. If that's true, the only solution I found is to insert explicitly a \n every newline in the text. So the mentioned example could be translated like that:

(venv) $ cat data/responses.md

## ask languages
* faq/ask_how_to_follow_people_on_twitter
  - 1. Find a Tweet from the account you’d like to follow.\n     2. Hover your mouse over their name.\n     3. Click the  **Follow**  button.\n \n     OR \n\n     1. Navigate to a Tweet from the account you’d like to follow.\n      2. Tap the  icon located at the top of the Tweet. \n     3. Tap  **Follow**  from the selection menu.

## ask blablabla
* faq/ask_blablabla
  - blablabla\nblablabla\nblablabla

Pretty unreadable, isn't it? It "works" but I don't like it for many reasons:

  • the answers on data/responses.md file become unreadable
  • I need to write a script that convert FAQs in markdown format, substituting each newline with \ns.
  • using RASA cli commands (e.g. rasa shell) conversation tests, I got the unreadable single line compacted texts :/

Two questions:

  1. Can I have FAQ answers in responses.md that are composed by multi-line texts (WTSIWYG "as" wrote in the markdown file, possibly whithout inserting '\n')?

  2. What's the suggested way to manage RASA Response Selectors answers, in case of answers made by long texts (~ a page/paragraph)?

UPDATE
I opened the issue/change request: https://github.com/RasaHQ/rasa/issues/5800

Thanks for your help

giorgio

Giorgio Robino
  • 2,148
  • 6
  • 38
  • 59

1 Answers1

0

If it is not too late for your project...or for another person coming-in from Google.

If you have long, multi-line texts, I would suggest not to mess up with the domain.yml directly.

It can get ugly pretty fast, and one misplaced indention can break the build.

What I'll suggest instead is a custom action that returns a long-form of text to your satisfaction.

You'll have freedom to do whatever you want.

In python, to do this, you wrap your texts in triple marks like so:

""" My long form text here """

It can stretch to any length and span many lines.

Wale
  • 1,321
  • 16
  • 11
  • Thx @Wale, but the question is related specifically to response Selectors, see https://github.com/RasaHQ/rasa/issues/5800. A custom action (that maybe read a text file in case of a long answer, could be a pragmatic solution, even if, also in this case (standard intents) I'd highly prefer to have multiline utterances responses in domain.yml and not in custom actions. – Giorgio Robino Jun 11 '20 at 10:24
  • BTW, with the custom action way, the advantage of responses in text files could be maybe the possibility to have responses wrote in a template language (mustache, etc.)... – Giorgio Robino Jun 11 '20 at 10:28