Search code examples
pythonchatbotrasa-core

Rasa Core: How to combine multiple utterances for an intent


In my stories.md file, if I have something like this

* mood_greet
 - utter_happy
 - utter_open_question

Only the first utter action i.e. utter_happy shows up and not followed up utter_open_question. I have followed up all the issues and the only solution I have found is to append the second question with the first dialogue and place them in an action function.

Any help will be highly appreciated for a beginner like me.


Solution

  • Maybe you used an old Rasa version which had a bug. With the example you have shown, it is actually the expected behavior that both, utter_happy and utter_open_question, are executed.

    Example

    Story file:

    ## Story 1
    * greet
      - utter_hello
      - utter_how_can_I_help
    

    Domain file:

    intents:
      - greet
    
    actions:
      - utter_hello
      - utter_how_can_I_help
    
    templates:
      utter_hello:
        - text: "Hi"
      utter_how_can_I_help:
        - text: "How can I help you?"
    

    If you now train Rasa Core as described here and then run Rasa Core as described here and then trigger the intent greet by sending a message /greet it will utter:

    Hi
    How can I help you?
    

    Possible reasons for the behavior you are having are: * you did not put a template for utter_open_question in your domain file * a problematic policy configuration * you are not using Rasa NLU and sent a message like "Hello". Either use Rasa Core without NLU and trigger intents by sending message with a prefixed / and the intent (e.g. /<intent_name>) or connect Rasa Core with NLU.