From zero to hero: Creating a chatbot with Rasa NLU and Rasa Core

AI assistants are a hot topic these days. Chances are that you have already had an encounter with at least one of them, as a user or as a developer. In this post, I would like to talk about a stack of software called Rasa, which you should definitely include in your toolbox if you would like to build conversational assistants yourself.

In short, Rasa NLU and Rasa Core are two open source Python libraries for development of conversational AI. They are packed with Machine Learning and handle natural language understanding and dialogue management tasks. Most importantly, Rasa stack is easy to use, you don’t need massive amounts of training data to get started and it is perfectly suited for production.

I have been building chatbots with Rasa stack for almost a year now and it is safe to say, that it has been a tool that I have been the most excited about throughout that time. And here is why:

  • It is open source. You own your data and you can hack things.
  •  It is developer friendly. You don’t even need to know Python to use it.
  •  It has an awesome community and highly involved developers. If you have any issues, just post a message on Rasa Community Forum and someone from Rasa team or other developers will help you out.
  •  It is a great example of how applied research can be shipped to practice and empower thousands of developers around the world.

So… With all that in mind, I decided to make a tutorial on how to create a chatbot using Rasa stack completely from scratch. It is going to be an exhaustive tutorial, with a deep dive into Python (if you don’t code in Python, don’t get discouraged – check the Rasa documentation of how you can do it all without any Python whatsoever). I am going to build a simple Slack integrated weather bot, called Frank. I highly encourage you to follow along so grab a cup of tea and let’s build some chatbots! 🙂

Update: The devs of Rasa NLU and Rasa Core are doing an amazing job updating and improving these libraries. Since I recorded this tutorial there were quite a few things introduced to Rasa NLU and Rasa Core which brought some changes in how some things should be coded. To keep this video consistent with the code, I updated requirements.txt file so that it would install Rasa NLU 0.11.4 and Rasa Core 0.8.2 – the versions which I used when I recorded the tutorial. If you want to use the latest releases of NLU and Core, you can find this directory which contains the tutorial code, compatible with the latest releases of these libraries (keep in mind, that the code will slightly differ from the one shown in the video).

Useful links:

Data files used in this tutorial
Full code of this tutorial
Full code of this tutorial [Latest release of Rasa NLU and Rasa Core]

Rasa NLU documentation
Rasa Core documentation
Rasa: Open Source Language Understanding and Dialogue Management (paper)
Rasa Community Forum

123 thoughts on “From zero to hero: Creating a chatbot with Rasa NLU and Rasa Core”

  1. Hi Justina,

    was creating the trainer data, then come accross this error at the command prompt when creating the nlu model, any idea, i searched thru google saying this is due to the nlu data being small? should i add more data? thanks

    C:\Users\hellf\Desktop\weatherbot>python nlu_model.py
    Fitting 2 folds for each of 6 candidates, totalling 12 fits
    C:\Program Files\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.
    ‘precision’, ‘predicted’, average, warn_for)
    C:\Program Files\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.
    ‘precision’, ‘predicted’, average, warn_for)
    C:\Program Files\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.
    ‘precision’, ‘predicted’, average, warn_for)
    C:\Program Files\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.
    ‘precision’, ‘predicted’, average, warn_for)
    C:\Program Files\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.
    ‘precision’, ‘predicted’, average, warn_for)
    C:\Program Files\Python36\lib\site-packages\sklearn\metrics\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 in labels with no predicted samples.
    ‘precision’, ‘predicted’, average, warn_for)
    [Parallel(n_jobs=1)]: Done 12 out of 12 | elapsed: 0.0s finished

    C:\Users\hellf\Desktop\weatherbot>C:\Users\hellf\Desktop\weatherbotC:\Users\hellf\Desktop\weatherbot

  2. Hi Justina,
    First of all, thanks for the very useful tutorial. When i am trying to run train_init.py ( by the way, there is no such file in your github account, and i created this file from your video tutorial) , i am gettinh this error :

    (weatherbot) C:\chatbot_train\Weatherbot>python train_init.py
    C:\Anaconda3\envs\weatherbot\lib\site-packages\h5py\__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
    from ._conv import register_converters as _register_converters
    Traceback (most recent call last):
    File “train_init.py”, line 7, in
    from rasa_core.agent import Agent
    File “C:\Anaconda3\envs\weatherbot\lib\site-packages\rasa_core\agent.py”, line 38, in
    from rasa_nlu.utils import is_url
    ImportError: cannot import name ‘is_url’

    do you have any idea about he problem. i used the latest requirements.txt file from your github.

    thanks.

    zekeriya

Leave a Reply