Interpreters

The job of interpreting text is mostly outside the scope of Rasa Core. To turn text into structured data you can use Rasa NLU, or a cloud service like wit.ai. If your bot uses button clicks or other input which isn’t natural language, you don’t need an interepreter at all. You can define your own Interpreter subclass which does any custom logic you may need. You can look at the RegexInterpreter class as an example.

To use something other than Rasa NLU, you just need to implement a subclass of Interpreter which has a method parse(message) which takes a single string argument and returns a dict in the following format:

{
  "text": "show me chinese restaurants",
  "intent": {
    "name": "restaurant_search",
    "confidence": 1.0
  }
  "entities": [
    {
      "start": 8,
      "end": 15,
      "value": "chinese",
      "entity": "cuisine"
    }
  ]
}

Fixed intent & entity input

Sometimes, you want to make sure a message is treated as being of a fixed intent containing defined entities. To achieve that, you can specify the message in a markup format instead of using the text of the message.

Instead of sending a message like Hello I am Rasa and hoping that gets classified correctly, you can circumvent the NLU and directly send the bot a message like /greet{"name": "Rasa"}. Rasa Core will treat this incoming message like a normal message with the intent greet and the entity name with value Rasa.

If you want to specify an input string, that contains multiple entity values of the same type you can use

/add_to_shopping_list{"item": ["milk", "salt"]}

Which corresponds to a message "I want to add milk and salt to my list".