Search code examples
loggingrasa-nlurasa-core

Logs for Rasa in command-line mode


I would like to log conversation (especially intents) from a Rasa bot. There is a perfect feature for that when Rasa NLU is run as an http server, but I can't seem to find anything similar when running in command-line mode. Is there a way to do that ? If, not, would there be a way to implement that ?


Solution

  • In the Rasa Core architecture a class called Tracker contains the history of the current conversation. I imagine you may implement your log by calling its as_dialogue method.

    Looking at the docs, the output of this serialization seems to be exactly like the items in the logs produced by the server:

    {  
      "py/object":"rasa_core.conversation.Dialogue",
      "events":[
        {
          "py/object": "rasa_core.events.UserUttered",
          "entities": [],
          "intent": {
            "name": "greet",
            "confidence": 1.0
          },
          "text": "/greet"
        },
        {
          "py/object": "rasa_core.events.ActionExecuted",
          "action_name": "utter_greet",
          "unpredictable": false
        }
      ],
      "name":"hello_world"
    }