How to respond random utterences for an input

Hi,

I want to show random utter’s to the users on a similar kind of input from the user. Like if user says hi, hello, help I have to respond with like

how can I help?

Hi, How may I help you?

Hi I am sara how can I help?

Do I need to write the stories for all the possible combinations to get the random response? Can anybody help me to solve this?

Regards

hey @raghavendrav1210 you can do so just refer this docs:

Domains

1 Like

Hi @raghavendrav1210,

If i understand it right, you can do the following :

  • In your training data (nlu_data.md) you should add an intent ## intent:name_of_your_intent that group the keywrods : “Hi”, “Hello”, “Help”, etc.

  • In your domain file (domain.yml) you should add a template that regroup the answers you want the bot to give back to the user :

      utter_name_of_your_template:
        - text: how can I help?
        - text: Hi, How may I help you?
        - text: Hi I am sara how can I help?
    

The fact that you define multiple text option in your template will make the bot choose randomly one of them.

  • In your stories you should add a story that define this use case like so :

name_of_your_story

* name_of_your_intent
 - name_of_your_template

Hope it helped,

Regards

1 Like