Search code examples
rasa-nlurasa-core

How to utter the input text as output (respnse) in rasa core?


Example-

Input -> My name is XYZ

Output -> My name is XYZ

I want this to happen for every input.


Solution

  • You can use custom actions to accomplish this behaviour. Should this only happen for certain intents or in general? Story would look like:

     * intent_whose_message_should_be_mirrored
       - action_respond_with_user_message
    

    And the like:

    class ActionRespondWithUserMessage(Action):
       def name(self):
          return "action_respond_with_user_message"
    
       def run(self, dispatcher, tracker, domain):
          last_message = tracker.latest_message.get("text", "")
          dispatcher.utter_message(last_message)
    
          return []