First try with RASA chatbot

28 October 2022
Conversation automation
backend

Having toying around with RASA bot for a couple of days, I adopted the open source conversational AI framework into a workflow of one of my project. The project requires a chatbot with interactive menu in the UI to get the automation done, and RASA bot is the perfect candidate for that.


Setup

The setting up of RASA project requires python envinronment and tooling.

This is what works for me.

  python3.8 -m pip install virtualenv
  mkdir rasa-bot
  cd rasa-bot
  python3.8 -m virtualenv venv
  source venv/bin/activate
  python3.8 -m pip install rasa
  rasa --version
  rasa init

Additional frequently used commands

  1. I added --enable-api because my application mainly communicate via APIs.
  rasa run --enable-api
  1. After making changes to the nlu.yml

rasa train


Chat in action

My application can start replying to conversations by sending the message to my RASA bot server.

POST http://0.0.0.0:5005/webhooks/rest/webhook

{
  "sender": "test_user",
  "message": "Hi"
}

Sample response

[
    {
        "recipient_id": "test_user",
        "text": "Hey! How are you?"
    }
]

That's a good start, since I can now reply to a conversation from the response from RASA bot.

We want now move on to train the bot for more specific use case by determining the intent of the message.

And we can do this by editing the file in data/nlu.yml.

For example, add

- salam sejahtera

to

- intent: greet

and run rasa train to update the model.

We can also define form depending on the business logic to handle more specific use case. Restaurant reservation/ordering for example.


That's all for today!

Cheers.