Warning: This document is for an old version of Rasa Core. The latest version is 0.14.5.

Interpreters

Rasa Core itself does not interpret text. You can use Rasa NLU for this.

class rasa_core.interpreter.RasaNLUHttpInterpreter(model_name: str = None, endpoint: rasa_core.utils.EndpointConfig = None, project_name: str = 'default')[source]
parse(text, message_id=None)[source]

Parse a text message.

Return a default value if the parsing of the text failed.

class rasa_core.interpreter.RasaNLUInterpreter(model_directory, config_file=None, lazy_init=False)[source]
parse(text)[source]

Parse a text message.

Return a default value if the parsing of the text failed.

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"
    }
  ]
}

Buttons and other Structured Input

If your bot uses button clicks or other input which isn’t natural language, you don’t need an interpreter 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.

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".

If you want to specify the intent confidence, you can use:

/deny@0.825

Which feeds the intent greet with confidence 0.825. Combining confidence and entities:

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

Have questions or feedback?

We have a very active support community on Rasa Community Forum that is happy to help you with your questions. If you have any feedback for us or a specific suggestion for improving the docs, feel free to share it by creating an issue on Rasa Core GitHub repository.