Create Your Own AI Chatbot in minutes with Rasa

AI Chatbots are an increasingly popular way to service your users. They allow you to field diverse UX requests without pages and pages of buttons for every possible thing that a user might need.

The issue, however, is that building and training an AI …


This content originally appeared on DEV Community and was authored by Saji Wang

AI Chatbots are an increasingly popular way to service your users. They allow you to field diverse UX requests without pages and pages of buttons for every possible thing that a user might need.

The issue, however, is that building and training an AI chatbot can be an incredibly burdensome task that oftentimes simply isn’t worth the effort.

Rasa is attempting to change that. Rasa is an open-source tool to quickly create and train an AI chatbot for whatever purpose you need. You simply enter in near plain-english how you want your chatbot to operate, give it some example inputs, and then reap the benefits.

Setting up the Demo

You can quickly setup a demo in minutes with the following commands(Make sure you have python installed):

Setup the python environment and install Rasa via pip:

python3 -m venv ./venv
source ./venv/bin/activate
pip3 install rasa

Setup, train, and run the Rasa project:
Rasa init

From there, Rasa will run the default chatbot in the command line for you to play around with

Image description

How to Customize Your Chatbot

Okay, if you’re following along you might have realized that the demo bot is pretty limited, so how can we add more functionality?

There are five key components to build your Rasa bot:

  1. NLU data
  2. Responses
  3. Stories
  4. Forms
  5. Rules

NLU(Natural Language Understanding) Data is the training data that you feed Rasa. You simply need give it examples of ways a person might say something, and then classify what those different messages mean into intents:

Image description

Responses are the ways in which you want your bot to be able to respond:

Image description

Stories are the paths that you want a conversation to be able to take:

Image description

Odds are you’re using your chatbot to collect some sort of data from users. Forms are the way you can structure requests that you need your chatbot to make and what to do when they successfully collect that information:

Image description

Finally, rules are exactly what they sound like. They can place strict requirements on ways your bot should interact:

Image description

After you edit all these parameters to customize your bot, make sure to retrain your bot with:

rasa train

How to Deploy your Chatbot

So now that you have customized your bot, how can you actually use it? Among other ways, Rasa allows you to deploy your bot as an API!

We’d recommend using Codesphere, an all-in-one web IDE and Cloud provider that allows you to deploy any app in minutes.

You can get your project setup in Codesphere simply by connecting the github repo and installing all the necessary dependencies through the command line.

When you are ready to deploy, simply run:

rasa run -p 3000

And the api will be running on port 3000.

We can then make post requests to the chatbot at:

http://<host>:<port>/webhooks/rest/webhook

With a json with the following format:

{

“sender”: “test_user”, // sender ID of the user sending the message

“message”: “Hi there!”

}

Note that Rasa will automatically track user sessions from senders with the same sender ID, and will even clear inactive senders after a given time period(1 minute by default).

Additionally, Rasa can be connected through Websockets, Slack, Telegram, and a myriad of other ways! You can learn more here!

And that’s all it took to get our chatbot live!

Let us know down below what you’re going to use your chatbot for!

Happy coding from the Codesphere team!


This content originally appeared on DEV Community and was authored by Saji Wang


Print Share Comment Cite Upload Translate Updates
APA

Saji Wang | Sciencx (2022-07-02T13:12:01+00:00) Create Your Own AI Chatbot in minutes with Rasa. Retrieved from https://www.scien.cx/2022/07/02/create-your-own-ai-chatbot-in-minutes-with-rasa/

MLA
" » Create Your Own AI Chatbot in minutes with Rasa." Saji Wang | Sciencx - Saturday July 2, 2022, https://www.scien.cx/2022/07/02/create-your-own-ai-chatbot-in-minutes-with-rasa/
HARVARD
Saji Wang | Sciencx Saturday July 2, 2022 » Create Your Own AI Chatbot in minutes with Rasa., viewed ,<https://www.scien.cx/2022/07/02/create-your-own-ai-chatbot-in-minutes-with-rasa/>
VANCOUVER
Saji Wang | Sciencx - » Create Your Own AI Chatbot in minutes with Rasa. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/07/02/create-your-own-ai-chatbot-in-minutes-with-rasa/
CHICAGO
" » Create Your Own AI Chatbot in minutes with Rasa." Saji Wang | Sciencx - Accessed . https://www.scien.cx/2022/07/02/create-your-own-ai-chatbot-in-minutes-with-rasa/
IEEE
" » Create Your Own AI Chatbot in minutes with Rasa." Saji Wang | Sciencx [Online]. Available: https://www.scien.cx/2022/07/02/create-your-own-ai-chatbot-in-minutes-with-rasa/. [Accessed: ]
rf:citation
» Create Your Own AI Chatbot in minutes with Rasa | Saji Wang | Sciencx | https://www.scien.cx/2022/07/02/create-your-own-ai-chatbot-in-minutes-with-rasa/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.