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 chatbot can be an incredibly burdensome task that oftentimes simply isn’t worth the effort. Rasa [https://rasa.com/] is attempting to change that. Rasa is an open-source tool to quickly create and train an AI chatbot for whatever purpose you nee

July 2, 2022 3 Min Read
Create Your Own AI Chatbot in minutes with Rasa
Create Your Own AI Chatbot in minutes with Rasa

Codesphere

From everyone in the Codesphere Team:)

Table of Contents

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


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:


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

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

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:


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


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

Rasa even provides a customizable chat widget for easy embedding:


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!

About the Author

Create Your Own AI Chatbot in minutes with Rasa

Codesphere

From everyone in the Codesphere Team:)

We are building the next generation of Cloud, combining Infrastructure and IDE in one place, enabling a seamless DevEx and eliminating the need for DevOps specialists.

More Posts

Cloud Native Meetup Recap

Cloud Native Meetup Recap

Karlsruhe offers a vibrant tech scene and we are proud to be part of a group organizing expert & community meetups like this one.

Full Metal

Full Metal

Buying a used server on ebay kleinanzeigen and preparing it to be cloudified? Follow along to see what it takes to get a piece of metal running.

Structure PDF Table Data for AI Applications with GMFT

Structure PDF Table Data for AI Applications with GMFT

GMFT is a fast, lightweight toolkit for extracting tables from PDFs into formats like CSV, JSON, and Pandas DataFrames. Leveraging Microsoft's Table Transformer, GMFT efficiently processes both text and image tables, ensuring high performance for reliable data extraction.