Rasa open source is an excellent Machine Learning framework to develop conversational bots be it text- or voice-based assistants.
And yes! It’s just like a cherry on the cake since it is an open platform.
The market of conversational bots is growing at a rapid pace with a tremendous Compound Annual Growth Rate(CAGR). Since conversational bots are now based on AI, they can do things way beyond customer support like personalized recommendations, restaurant/hotel bookings, front-line sales, lead generations, customer onboarding, handle customer purchases and much more.
With such vivid and useful features, a wide range of industries are adapting this technology as it is helpful in increasing the company revenue.
In this article, we will build the covid tracker bot using Rasa which will get the information on Covid cases just by typing the city name. So, let’s get started.
Installing and Setting Up the Project in Rasa
You can install Rasa by using the pip command on your command prompt (for more information you can refer to the installation guide by rasa).
Now that Rasa is installed on your machine, it’s time to set up the new project by using the following command.
Image Source: rasa.com
This will basically create the assistant with some example training data in it, now you can modify this assistant as per your customized needs.
The project setup of rasa contains the following files:
Setting up the Rasa Files
Now, we will set up all the files which are required for our Covid Tracker Bot.
NLU extract’s information from user messages. This information is used to understand what the user is trying to say and that decides what reply assistant has to give. User message is understood by identifying the Intent and Entity in the user message. In the above image, state is the entity and name of the state(Gujarat, Rajasthan etc.) is its value. While corona_state is the name of the intent which contains all the training/sample messages and it is triggered when the user message matches its one of the training/sample messages.
Stories are like the training data of your assistant. Your assistant learns from the conversation path that you provide in the stories and follows the same path while interacting with the users. In stories, asterisk(*) represents the intents and (-) dash represents the assistant’s response. You can customize this conversation as per your own domain.
You can run any custom code that you wish to by using actions. The assistant will predict which action to take after the user input. To keep it simple, you can make an API call, fetch data from database, store data into database, fill forms, restart your chat and much more. In our example, the name of our action is ‘action_corona_tracker’ and we will use this to make an API call, as a result of which our bot will fetch the information on corona cases from a website. All actions have to be listed in the stories and domain.
Domain contains all the things that your assistant is built upon like intents, entities, actions, responses, forms etc. Inshort everything gets registered in the domain. It is also referred to as the universe in which your bot operates.
Endpoint configuration connects NLU to other endpoints. You can specify an endpoint configuration here.
The config.yml file contains all the components and policies which are used by the assistant to make predictions based on the user input. As per your project need, you will need to adjust your config.yml settings based on your training data to get the best results.
Training the Model
Now that we have made all the settings, we will train the model and test our bot.
To get started, open the rasa environment in two command prompts.
In the first command prompt, train your model by ‘rasa train’ command.
In the second command prompt, start your action server by ‘rasa run actions’ command.
After your model has been trained, it’s time to run the rasa shell to test the bot.
The Rasa shell is used to load your trained model and run it on the command line.
So now, you can ask your bot the covid cases for each state. You can also just simply type the state name and your bot will fetch the information for you. This way you can customize your bot as per your needs and domain by changing the stories, actions you want to take, intents etc.
In this article, we learned how to build a covid tracker bot which extracts the covid cases from a website. Similarly, conversational bots have a large number of use cases which can also be used to ease the business processes and increase the revenue. If you know `such a use case that has made things better, please share it in the comment box.
Join Our Discord Server. Be part of an engaging online community. Join Here.
Subscribe to our NewsletterGet the latest updates and relevant offers by sharing your email.
I am a Machine Learning Scientist and like to research the use cases of Artificial intelligence and how it can be leveraged for business purposes. The curiosity of knowing anything in-depth that is what defines me. Analytics is more about the interest in knowing anything in-depth and getting a result from the same. Apart from this, I am an Automobile fanatic and spend my time around it.