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

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

  1. Thanks for sharing, I see you you said you have around 1 year of experience. I wonder if you have any examples of a bot you built online already? Would be great to see it. Thanks.

    1. Hey, thanks for checking it out! 🙂 The biggest chatbot I have built so far is for internal use of the company which I currently work for, so I can’t share it online, unfortunately. If you are interested in what it is about, you can check this interview where I spoke a little bit about it https://medium.com/rasa-blog/building-bots-with-rasa-shiba-slack-hosted-interface-for-business-analytics-ed47f346a16b . Apart from that, I am currently in a process of developing another chatbot which I think will be worth sharing online. I will post about it here once it’s done 🙂

  2. Hi Justina,

    I really appreciate the effort you have taken inorder to put this really nice example out. I am currently also working on a Rasa_NLU , but its nice to see how i can integrate with Rasa_core .

  3. Hi there thanks for all the guidance. However, i am getting this error “Unable to find vcvarsall.bat”
    Installed python 3.5.2. Im stuck can you please help?

    1. Hey 🙂 I am pretty sure it is your Visual Studio complaining. Can you share some more details on your current setup? What VS version do you have and can you share a full error log? If you want to, you can drop me a direct message with those details.

  4. hey nice tutorial
    I tried on different data but even after giving around 40 stories next_action is always action_listen, can you help me?

    1. Hey, swaps. Thanks for checking it out! 🙂 Would you mind sharing your domain and some of your stories and nlu data with me so I could reproduce it? You can shoot me a DM on Twitter, Linkedin or send me an email.

    1. Hey Alisa! Thanks for checking it out. I hope you will continue using Rasa and creating cool chatbots 🙂

  5. Hi Justina,

    Thank you so much for creating this awesome content. It has got me started in chatbots. I have one question. How to give multiple choices to the user and then proceed with the user’s response?

    1. Hi Palash,

      Thanks for checking out the tutorial, I’m glad you found it helpful 🙂

      Do you want to implement buttons or do you want to keep it fully conversational? If you want to go the button route, then I would suggest you checking out Slack connector on Rasa Core https://core.rasa.com/connectors.html#slack-setup , it has a button functionality already implemented (if you need any help with using it, just shoot me a message). If you don’t want to use buttons, then in your domain file you should simply create a template or an action which will send a message with multiple options to your user and the user’s response should be parsed using NLU model and saved as a slot. Let me know if you need help with anything 🙂

      1. Can I keep it both conversational and buttons whenever needed? I think the button route is sometimes very useful when I want to avoid any user mistakes. And what if I want to integrate the chatbot with a website and not with the existing messenger platform?

      2. Hey. Yes, your bot can use buttons and conversational responses depending on which one is needed. You will only need separate actions for those cases. Speaking of custom integration – it shouldn’t be a problem to integrate your chatbot with a custom website, for this, you can run Rasa as an http server (more on this here: https://core.rasa.com/http.html) or you can create your custom connector (here is an example for a custom connector from Rasa https://github.com/RasaHQ/rasa_core/blob/master/rasa_core/channels/custom.py).

  6. HI Justina, Thanks for the awesome work. I followed it and it worked. But couple of queries. How do i not end the conversation until, i say good bye? The bot automatically goes to BYE intent after it answers the weather results? could i keep asking weather for multiple times and not end the conversation , until i say bye?

    Thanks
    Roshan

    1. Hi Roshan. I am glad you gave it a try! 🙂 I think your problem related to the lack of training data. In my example I had only a few stories and it is likely that the bot will make a lot of mistakes. Try adding more stories to stories.md file and see if that improves the performance 🙂

  7. Hi,

    I am running this on Python 3.6 /Win 10 and this is happening while training the model:

    PS C:\developerfolder\weatherbot> python nlu_model.py
    Traceback (most recent call last):
    File “nlu_model.py”, line 1, in
    from rasa_nlu.converters import load_data
    File “C:\Users\renji\AppData\Local\Programs\Python\Python36\lib\site-packages\rasa_nlu\__init__.py”, line 5, in
    import version
    ModuleNotFoundError: No module named ‘version’

    1. Hey R.Phil 🙂 I believe the issue is due to the updates which were introduced to Rasa NLU after I recorded the tutorial. I have made an update recently where in requirements.txt I specified which Rasa NLU and Core version I used in a tutorial. If you prefer, you can use the latest versions of the libraries, but then check out the new repo which contains the code which should run with the latest releases of Rasa NLU and Core. Let me know if the issue persists 🙂

  8. Hi Justina,

    First of all thank you for the wonderful tutorial. I am getting the below error when I run the train_online.py, bot is not able to move to the actions.

    D:\Python36\lib\site-packages\sklearn\preprocessing\label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.

    I don’t find solution anywhere, need your help

    1. Hi Lawrence. Thanks for checking out the tutorial! 🙂 The error you get is not really an error, it’s a deprecation warning coming from sklearn. This shouldn’t affect your models at all, it’s just an annoying message which gets printed every time an response is provided by your bot. You try muting them by following the instructions here https://docs.python.org/2/library/warnings.html (just add those lines to you train_online.py code. Let me know if that helps.

  9. Please help!I have installed the nlu trainer just like you said.But when I run “rasa-nlu-trainer” in the same directory as my JSON file, I get the following error :-

    Devanshs-MacBook-Pro:data devanshsingh$ rasa-nlu-trainer
    searching for the training examples…
    (node:32128) UnhandledPromiseRejectionWarning: Error: Can’t find training file, please try to specify it with the –source option
    at checkDone (/usr/local/lib/node_modules/rasa-nlu-trainer/server.js:98:15)
    at readData.then.catch.then (/usr/local/lib/node_modules/rasa-nlu-trainer/server.js:128:11)
    at
    (node:32128) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
    (node:32128) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

    1. Hey Devansh. That’s odd. Have you tried specifying the file using –source option?

  10. Thanks a lot Justina for the share. It would be really helpful if you can suggest me how can I train my model from data which is contained in pdf form. The chat bot should be able to answer all the FAQ related to the pdf file……Is there any way…?
    Thanks again and keep sharing.

    1. Hey Rahul. Thanks for checking out the tutorial! Could you give me the example of what queries users would have and how the answer of the bot would look like? The things is, Rasa is awesome for building goal-oriented bots, but I am not sure if it is the best choice for FAQ bots. An example of possible conversation would help me to give a more proper advice. If you prefer, you can send it to me as a private message or reach out to me using any social media channels you can find on my blog 🙂

  11. Hi Justina Petraityte,

    Hope you’re doing great!!! Your video about rasa core and rasa nlu is really awesome. You thought in such a way so that even a beginner in rasa /python can understand each and every line of it.

    Could u have a video about the latest rasa core/nlu changes?

    1. Hi Revathy. Thank you so much for your kind words, I really appreciate it! The goal of this tutorial was exactly that – to help people of all levels of programming expertise to get started with Rasa! Based on your awesome feedback I can assume that the goal was achieved 🙂

      I should post more content on Rasa quite soon so stay tuned!

  12. Hi Justina first of all thanks for this video. can you tell me how to create a context based chatbot? not stateless

    1. Hey Pankaj. Thanks for checking out the tutorial. You can use Rasa Core for context-based chatbots – slots are used to keep the context and track what the conversation is about. Can you give me an example of what do you mean by a context-based chatbot, not stateless?

      1. If you familiar with Dialogflow then they have follow–up intent I am taking about this only see one seneario here In my chatbot I have two follow 1) registration 2) troubleshooting so if user ask I want to register as new customer then my bot Will response tell me your name when user enter name then bot will response tell me your mail I’d ….so on… same I have some flow-up intent for troubleshooting how can I do this??

      2. So, in Rasa Core you would simply have an intent for that (in my tutorial I used an intent called ‘inform, which is a generic intent to provide the location information’. For the model to pick up different conversation patterns (one for when user provides all details immediately; another one for the case when a user just starts a registration and a bot has to ask all the details, etc.) you have to create training stories which would cover those scenarios. In my tutorial, I have a case when a user immediately told what location he is asking about and another one when a bot has to clarify those details.

      3. So this what Rasa Core is all about. You should train your dialogue management model using stories where bot asks all of those questions and the information which gets extracted from user’s responses should be save as slots to keep the context. Just like in my video – I trained the bot to follow up with a question about the location if a user didn’t provide the location immediately when asking about the weather.

  13. hi i am facing the entities extraction issue like my bot response enter your name then user will enter Michael Jackson but it will not extracted the value if i give like my name is Michael Jackson than it will extracted but i want to give only Michale Jackson
    here is the config file

    {
    “pipeline”:”spacy_sklearn”,
    “path”:”./models/nlu”,
    “data”:”./data/data.json”

    }

  14. Hi Justina! Great work done by you, tnx! Just loved this tutorial, easy to follow!

    For a followup of my bot I would like to be able to extract Dutch names as an entity. The default tagger doesn’t get Dutch names correctly very often. I have a list of all the Dutch names available; do you have a suggestion where to start / apply this functionality?

    Again, tnx and keep up the good work!

    Regards,
    Ramon

    1. Hey. Thanks for checking out the tutorial 🙂 You should be able to train the model in Dutch by using spacy dutch model https://spacy.io/usage/models (the change should be made inside the configuration file). Check it out and let me know if you need more help with it.

  15. Hi Justina Petraityte,

    Hope you are doing well!!!…
    Getting below error while installing the requirement.txt using pip :

    bleach 1.5.0 has requirement html5lib!=0.9999,!=0.99999,=0.999, but you’ll have html5lib 1.0.1 which is incompatible.
    tensorboard 1.8.0 has requirement html5lib==0.9999999, but you’ll have html5lib 1.0.1 which is incompatible.
    tensorflow 1.8.0 has requirement numpy>=1.13.3, but you’ll have numpy 1.13.1 which is incompatible.
    rasa-core 0.9.6 has requirement coloredlogs~=10.0, but you’ll have coloredlogs 7.3 which is incompatible.
    rasa-core 0.9.6 has requirement ConfigArgParse~=0.13.0, but you’ll have configargparse 0.12.0 which is incompatible.
    rasa-core 0.9.6 has requirement fakeredis~=0.10.0, but you’ll have fakeredis 0.8.2 which is incompatible.
    rasa-core 0.9.6 has requirement fbmessenger~=5.0, but you’ll have fbmessenger 4.3.1 which is incompatible.
    rasa-core 0.9.6 has requirement flask~=1.0, but you’ll have flask 0.12 which is incompatible.
    rasa-core 0.9.6 has requirement graphviz~=0.8.0, but you’ll have graphviz 0.7.1 which is incompatible.
    rasa-core 0.9.6 has requirement networkx~=2.0, but you’ll have networkx 1.11 which is incompatible.
    rasa-core 0.9.6 has requirement requests~=2.15, but you’ll have requests 2.14.2 which is incompatible.

    but still the installation goes on, is it fine? or do i need to change any version?

  16. Hi Justina,

    Thank you for providing such good and useful information on Rasa NLU project.

    I have an issue while running ‘action.py ‘ file at ‘apixu’ package/library.
    error message: ModuleNotFoundError: No module named ‘apixu’.

    please help me out how to install ‘apixu’ module in anaconda-spyder for python.

    Thank you.

  17. Hi Justina,

    Enjoying your tutorial immensely and the quality is top-notch. Thank you for all your efforts! Not sure if this is the forum for a technical question but I ran into an error that is not making sense regarding the api call: Error code 1003: “Parameter q is missing.

    I’ve checked the code against your github and it all checks out. Any ideas?

    1. Hey Sean. Thanks a lot for your kind words, I am super happy you found my tutorial helpful! 🙂 I think what is happening is that it is not extracting the entity ‘location’ correctly. That’s why the parameter q is empty and throws you an error, when it tries to make an api call. A good solution for this would be to add more training data for NLU model (I had a really small sample for it in my tutorial) so that the model would be more confident in extracting entities.

      1. Worked brilliantly…thank you!! I finished the tutorial and I’m extremely interested in learning more about Rasa.

        Great work!!!

      2. Awesome! Glad it worked and happy to hear you are going to continue learning about Rasa!

      3. Awesome! Glad to hear it worked. Keep me updated with your progress 🙂

  18. Hey justina, thank you so much for ur awesome video. I have one small request, could u explain about the policies in rasa and about tensorflow? It ll be really helpful fr deep diving.. but as i said earlier your video is a blessing fr everyone who wants to learn rasa.

  19. Hello Justina, really nice and helpful tutorial. I have a question hopefully you can give me some tips. In your example their can be mutliple locations with the same name. So for example you ask “how is the weather in Neustadt”. And the API-Response gives you a list of different locations with this name. How would the user interaction look like. Would you save the response in a slot with type list and let the user choose one. What is the best solution for this with Rasa-Core. Thank you very much for your answer.

    1. Hey Jan. Thanks for checking out the tutorial! 🙂 How you handle the cases when an API returns more than one possible answer depends on how you want your chatbot to operate. A naive approach could be to select the random one and send it back to the user or a lot better one would be to save the returned options in a slot as a list and train the bot so that when the list slot is populated, a bot would ask a follow up question so that a user could provide more info of what specifically they want to see and then a bot could make a more accurate suggestions by picking the best option from the saved slot.

  20. Hi Justina, thank you very much for your tutorial. I have got a question. How would you program a user interaction when they are different locations from a Api-Response. For example their are a lot of cities with the Name Neustadt in Germany. How would you let the user choose out of a list, which one he means. Iam struggling with the interreupt of my first intenet to connect the two actions. I hope you can give me some tips to solve this problem. Sinercerly Jan

  21. i would like to say thank you for all the help that u did in by explaining the rasa working .. and helping us … though i would like to request u to make another video and show how it works on the latest updates of rasa

    1. Hey Bodghisatta, thanks a lot for checking out the tutorial! I am not sure if you had a chance to see the code for the latest version of Rasa in this repo. Nonetheless I have some new tutorials lined up which should come out quite soon!

  22. Hi Justina! I am new to chat-bots and I can gladly say you are a good teacher and your video really augmented my understanding. Though I am stuck at one point. When I launch python train_init.py, nothing happens. I am using jupyter notebook. I also researched online a lot and can’t find a solution. Can you help me out a bit?

    1. Hey Vikalp. I am so happy to hear my tutorial helped you out! Regarding your issue – do you get any errors with it and do you have jupyter notebook in the same directory as you the other weatherbot python files? If now, I would guess that your the agent is not finding the data and domain files.

  23. Hi Justina,

    It is been three months since i started working with rasa stack. I learnt a lot by making mistakes but what i don’t understand till now is that unusual prediction of next action from rasa core. You know friday it is working fine and monday it is all scrambled again. Not sure where we are missing out. Sometimes the flow works just fine when we test using rest client and not from bot. We have the rasa stack deployed as a container. Is there any solution or cause for this?

    Your reply will be very helpful.

    1. Hey Revanthy. Can you tell me how much training data do you have for Rasa Core as well as how many intents, entities and slots do you have? I think it could be the case of not sufficient amount of training examples for both NLU and Core models.

  24. Hi Justina! Even though I was able to make a connection to slack, my bot didn’t reply anything. Please help me!

    1. Hey Vic. Hm, that’s interesting. Do you use ngrok to establish the connection between your bot and slack? If yes – what output do you see returned by the ngrok?

  25. Hi Justine, I was trying to build the model but it takes 4-5 mins to load the model. Is there a faster way to load the model? I am using python3.5

    1. Hey Jaggu. Interesting… Are you loading your custom model or are you using the weatherbot? If you are following my tutorial and using dialogue_management_model.py to load your model in command line make sure to comment out train function, because chances are that you are constantly retraining your model which usually takes some time as well.

  26. Hello Justina,
    Thank a lot for this beautiful tutorial ! It will really help me understand how to build my future chatbot.

    I can not wait to see another tutorial from you, you’re really good at teaching!

    Good continuation

    1. Hey Thalie. I am so happy you found my tutorial helpful! I really hope to see some of your bots built in the future!
      I will definitely make time for more tutorials, thank you very much for your kind words 🙂

  27. Hi Justina,

    Thanks a lot for such an intuitive Tutorial.
    I have just started dealing with ChatBots from few weeks from now and it wouldn’t be that easy if your tutorial haven’t been there.

    I need a help regarding an issue that I am facing that is the User Interface and server I am using is in Node.js and after making certain changes in Console Channel code I am able to get few responses from the UI side like responses of Hi and Bye but some of the responses are not being conveyed and my main python file having the agent is being used as an child process in the node.js controller file .

    I am not getting any sort of error as well for example

    if I type on UI

    Hi or Bye

    it responds

    how can I help u or talk to u later respectively

    but when I ask for weather or weather at any location it responds as blank without any error or stuff

    It perfectly works fine on the console though.

    Please guide me where could be the problem area and if possible help me with solution as well.

    Thanks.

    1. Hey Anshuman. Glad to hear you are building chatbots!
      Regarding your issue: hmm, since it fails at the custom action stage (when a user asks for the weather) I would suspect that the issue hides there. I could guess a few scenarios:
      1. NLU model doesn’t recognize the entity ‘location’ which throws away the predictions of the core model. The solution for this would be adding more training examples for NLU model as well as more stories core Core model so that the bot would be more confident.
      2. The bot fails to make the api call (I would double check the api key for apixu and manually check what response the api call returns for your specified city)
      3. The agent doesn’t find actions.py file to execute the action. Does the agent follow up with ‘In what Location?’ if you don’t specify the city initially? If that works on your UI, then I would guess that the issue is with not finding the actions.py file. I would try to debug it by adding some print statements inside the actions.py function to see if the agent at least tries to execute that custom action.

      Let me know if the issue persists.

      1. Hi Justina ,
        Thanks for the reply
        Actually It is responding to Hi & Bye intents only not even for the ‘In What Location’ through Node js UI. But Through Console Channel on Console It is working fine even the api calls are working absolutely fine.

        What I can figure out is may be there is some issue with my Channel Code

        OR

        Using the Main python Code containing the bot agent as child process in node js controller,
        it is calling the process each and every time when response is send and killing it after each response.

        Please suggest what can be done

      2. In this case, then it definitely has to do with the way you run the bot. If your application loads the bot (starts the process) every time the new user input comes in, then your bots is not able to keep the context, because it thinks that every time the conversations starts from the beginning. You should run your bot on the server constantly instead of reloading it when the new user input comes in. It is the only way you bot will be able to keep the conversation, remember what the user said previously and make predictions for the responses other than hello or goodbye. One approach could be to deploy your agent on the local server or on the cloud and then use http requests to establish the connection between your agent and the node js controller. You can look into it more here: http://rasa.com/docs/nlu/0.13.1/config/ Let me know if that helps and if you need more help.

      3. Hi Justina,
        I really appreciate your help, Thanks a Lot

        Now My Bot is interacting fine with node layer there wasn’t any issue with the process being killed as when i rebuild the whole bot again with python integration i found out that some of the Intents which the bot can respond to in console But It can’t respond to it in node js UI
        I think there is some issue with it’s training.

        Can you help me with training the Bot properly

        Now i am pasting the responses I am getting from my bot in UI

        hi

        Hello! How can I help?

        tell me weather

        in dublin

        It is currently Partly cloudy in Dublin at the moment. The temperature is 15.0 degrees, the humidity is 88% and the wind speed is 5.6 mph.

        todays weather

        in london

        It is currently Overcast in London at the moment. The temperature is 20.0 degrees, the humidity is 78% and the wind speed is 4.3 mph.

        bye

        Hello! How can I help?

      4. Hi Justina Can we use singleton approach for our main app file to check if it works fine with node js as it’s child process

    1. Hey Raul,

      As of now, online training only works in the command line, but Rasa is looking into ways to improve that. If you have some ideas for this, make sure to contribute! 🙂

  28. Hi Justina,

    A great tutorial for getting started with building chatbots using rasa stack. However, I am stuck at a point where in I have two text inputs coming from user. I have slots assigned to both of these inputs with text as their type, but still my chatbot catches the intent of the first slot everytime. Can you help?

    1. Hey Santosh! Thanks for checking out the tutorial 🙂 Do you have entities defined with the same names as your slots? If yes, are both of them get extracted when you test your NLU model? If you could share with me your domain file, I could quickly look into it and try and find the issue. Feel free to email it to me. You can find my email on my github page.

    1. Hello Sivaram. An example of implementation of the fallback policy could look like this:

      from rasa_core.policies import FallbackPolicy, KerasPolicy, MemoizationPolicy
      from rasa_core.agent import Agent

      # this will catch predictions the model isn’t very certain about
      # there is a threshold for the NLU predictions as well as the action predictions
      fallback = FallbackPolicy(fallback_action_name=”utter_unclear”,
      core_threshold=0.2,
      nlu_threshold=0.1)

      agent = Agent(‘domain.yml’, policies=[MemoizationPolicy(), KerasPolicy(), fallback])

      # loading our neatly defined training dialogues
      training_data = agent.load_data(‘stories.md’)

      agent.train(
      training_data,
      validation_split=0.0,
      epochs=200
      )

      agent.persist(‘models/dialogue’)

      All of this code should be inside the file which you use to train the model (in my weatherbot example it would be dialogue_management_model.py). The main idea is that you define the name for the fallback action and the thresholds for NLU and Core models. Then you have to make sure to pass this policy to your agent.

      The last thing to keep in mind is that you have to include the fallback action inside you domain file as well as training stories so that your bot would learn to pick those up.

  29. Hi Justina,
    Thanks for the tutorial.
    Do Rasa support Vietnamese? If not ,How can I integrated Vietnamese to Rasa?

      1. Hi Justina,
        I am newbie so that please give me guide and example how to do that, I still confuse with it.
        Thank in advance.

  30. Hi Justina, thanks for putting up this great tutorial.
    I am facing a small error while running the latest code using the exact “requirements.txt” you have given. At the time of python dialogue_management_model.py, the tensorflow model gets trained, but it throws an error :
    FileNotFoundError: [Errno 2] No such file or directory: ‘/home/rahul/.virtualenvs/text_rasa/lib/python3.5/site-packages/spacy/data/en/vocab/strings.json’ and exits.
    It would be great if you could help me out.
    thanks

    1. Hey Rahul! Thanks for checking out the tutorial 🙂 Looks like your issues is related to spacy model. Have you downloaded the spacy english model?
      You can do it by running the following: python -m spacy download en

  31. Hi Justina

    Am executing python run_app.py as part of Pivotal Cloudfoundry app push instead of using Ngrok. But getting “ImportError: cannot import name ‘HttpInputChannel'”. What could be the reason for this exception?

    1. Hey Vignesh. This is related to a big Rasa Core update which happened last week. I haven’t updated my repo to use the changes, this is why you are getting the error. I will fix it in a bit:)

  32. Hello Justina !
    Thanks for this tutorial, it is really well explained !

    I just have a problem: I always have the same error when I run your code (“Full Code [Latest release of Rasa NLU and Rasa Core]”) :
    “Traceback (most recent call last):
    File “train_online.py”, line 13, in
    from rasa_core.channels.console import ConsoleInputChannel
    ImportError: cannot import name ‘ConsoleInputChannel’ ”
    I have absolutely no idea of where it comes from. I read that “cannot import name” error was often due to circular import dependencies in Python, but I don’t see how it is related to the current problem.
    Do you have any idea ?

    Thank you !

    1. Hey Camille. Thanks for checking out the tutorial 🙂 I am pretty sure that the error is due to the recent update on Rasa Core (there was a release of Rasa Core v.0.11 last week and there are some big changes). I will update the repo so that it would work with this new release.

  33. Hi Justina,

    having this error while installing requirement.txt :

    Command “python setup.py egg_info” failed with error code 1 in C:\Users\USER\AppData\Local\Temp\pip-build-cfnoxjzz\matplotlib

    Any thoughts?

      1. Hi Justina,

        thanks for the prompt reply, im downloading the latest version of phyton Python 3.7.0, from the python website. so I’m installing the win32 version as the x64 is not supported by my machine. Hope to hear from you as im stuck. Wish to complete your tutorial 😀

        Thanks and regards,
        Cyrus

      2. Hey Cyrus,

        I think Python 3.7 is not the best choice for now, because I think Tensorflow is not compatible with it yet. Another problem is that Tensorflow is not supported on win32. Any chance you can run it on Linux VM?

  34. What a nice and easy to follow tutorial.
    Looking forward for the updated repo to see the big change on the Rasa Core v.0.11 on work.
    Thanks Justina

  35. Hello Justina, Thank you verymuch for this is a super-duper tutorial .. even a beginner like me able to grasp well from your tutorial..
    I have a question …
    Our java based chat bot currently using dialogue flow. If we want to change it to RASA how do we interface that ? is there any REST api to send the request to RASA from our Java application ?
    Could you throw some lights on it?
    if possible could you point some samples on how to send request from external application

    1. Hey Vikas. Thank you very much! I am happy to hear that the tutorial was helpful! 🙂

      Speaking about the migration from DialogFlow to Rasa, I have just written a quick tutorial on how to migrate an existing app to Rasa which might give you some ideas on how to do it https://medium.com/rasa-blog/how-to-migrate-your-existing-google-dialogflow-assistant-to-rasa-412cd07f424a .

      Speaking of calling Rasa agent from Java application – you can definitely do that. You can run Rasa angent as an http server and then you can emulate it using REST. Here you can find some more information on how you can run a Rasa agent on a server http://rasa.com/docs/core/server/. Let me know if you need more help with implementing any of this.

      1. Hey Justina,

        Today I tried the RestInput mentioned in the below url
        https://rasa.com/docs/core/connectors/#restinput

        I post json to http://localhost:5005/webhooks/rest/webhook
        my json : {“sender”: “user1″,”text”:”hello”}

        but getting below error in the server console

        parse_message
        if (message.text.startswith(INTENT_MESSAGE_PREFIX) or
        AttributeError: ‘NoneType’ object has no attribute ‘startswith’

        Regards
        Vikas

      2. Hi Vikas. To me it seems like you are not starting Rasa server correctly. For example, to start weatherbot as the rasa server, you can run the following command: python -m rasa_core.run –enable_api -d models/dialogue -u models/nlu/default/weathernlu –endpoints endpoints.yml . Here, the parameter –enable_api is very important because only then the server will receive the post requests. Once the server loads, you can emulate the server by making request like: curl -XPOST localhost:5005/conversations/default/respond -d'{“query”:”hello there”}’ | python -mjson.tool
        Make sure to run custom action server in the background as well by running: python -m rasa_core_sdk.endpoint –actions actions

  36. Hello Justina,

    I’m sorry, it’s me again… I have trouble connecting my rasa bot to slack API…
    I have copy-past your code “rasa_slack_connector.py” and “run_app.py” into my project (changing HttpInputComponent into InputChannel etc. as said in rasa migration topic)
    But when I try to enable an event with the ngrok URL and the suffix “slack/events” (after having launched “run_app.py”), I still have the error “Your URL didn’t respond with the value of the challenge parameter. ”
    Do you have any idea where the problem comes from ?

    Thank you !

    1. Hey Camille,

      No worries, I am happy to help! 🙂

      To make it all work with Rasa Core 11 (which I assume you are using) I would suggest using the code from this directory https://github.com/JustinaPetr/Weatherbot_Tutorial/tree/master/Full%20Code%20%5BLatest%20release%20of%20Rasa%20NLU%20and%20Rasa%20Core%5D. I have made an update over the weekend to make it work with the latest releases of Rasa NLU and Core. The main difference between the code in this directory and the one shown in the video is that it uses Rasa’s in-built slack connector, that means that there is no need for my custom written rasa_slack_connector anymore and another difference is that you should use the suffix /webhooks/slack/webhook when providing the URL inside the event subscriptions page on Slack. I have written a step-by-setp guide on how to connect this assistant to Slack in a readme as well. Give it a try and don’t hesitate to let me know if you still have issues with making it all work 🙂

      1. Nice! Happy that it all works 🙂 keep me posted with your progress – I would love to learn more about what you are building with Rasa!

  37. Thanks for a very nice tutorial, I am new to Rasa and the tutorial really helped me to put things into perspective. I have a question I see in the stories.md file when you have a goodbye intent, you respond with a utter_goodbye and thereafter there is “- export” Could you please explain what this does, I am guessing it is something like a action_restart Thanks

    1. Hey Suresh. Thanks for checking it out! 🙂
      The export at the end of the stories is included only because I generated some of these stories using interactive learning (after you export the sotires into file, it adds export at the end of it). It doesn’t do anyting for the actual Rasa Core model though.

  38. Oh it appears that there were some issue with this blog… I posted same comments multiple times and none were displaying when I posted… Now all appearing…🤔

  39. Hi Justina, I have not been able to run it.Please help! Getting the error below:

    [tarun.bhavnani@dev.smecorner.com@sme-ho-desk-008 fc]$ python nlu_model.py
    RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb
    tf.estimator package not installed.
    Traceback (most recent call last):
    File “nlu_model.py”, line 21, in
    train_nlu(‘./data/data.json’, ‘config_spacy.json’, ‘./models/nlu’)
    File “nlu_model.py”, line 11, in train_nlu
    trainer = Trainer(config.load(configs))
    File “/home/tarun.bhavnani@dev.smecorner.com/anaconda3/lib/python3.6/site-packages/rasa_nlu/model.py”, line 152, in __init__
    components.validate_requirements(cfg.component_names)
    File “/home/tarun.bhavnani@dev.smecorner.com/anaconda3/lib/python3.6/site-packages/rasa_nlu/components.py”, line 63, in validate_requirements
    “Please install {}”.format(“, “.join(failed_imports)))
    Exception: Not all required packages are installed. To use this pipeline, you need to install the missing dependencies. Please install sklearn

    Thanks!
    Tarun

    1. Hey Tarun. Seems like you don’t have sklearn installed on your computer. Try installing it using pip install sklearn.

      1. I have all the dependencies installed. Also the code is running fine on spyder. But terminal run gives the stated issue.
        ty!!

  40. Hi Justina

    I have received this error when i trying to install rasa_core

    Could not find a version that satisfies the requirement tensorflow~=1.10 (from rasa_core) (from versions: )
    No matching distribution found for tensorflow~=1.10 (from rasa_core)

    1. Hey Nilesh. Have you tried installing tensorflow separately? What do you get when you do pip install tensorflow?

      1. This was the error when I try to install tensorflow separately.

        Could not find a version that satisfies the requirement tensorflow (from versions: )
        No matching distribution found for tensorflow

Leave a Reply