Build a Flight search chatbot from scratch using RASA-PART 1

In this article, we will build a chatbot from scratch using RASA framework which is open sourced under RASA technologies GmbH. There are many technical documentations on building chatbots, however, here, I'll try to make it simple and effortless.

Note- I am using Make My Trip(MMT) flight booking website to get the domestic flight information.


What sets RASA apart from Dialogflow, chatterbot or any other package? The first point is it needs some technical/coding skills so we, the developers, are not going to die jobless:). Joking aside, these technical skills allow us to customize our chatbot easily as compared to other chatbot packages. The source code is available in the GitHub repository. And also the old school python coding in notebooks like jupyter or notepad++, it feels like you are creating something out of your own hand.

Let us get started now!


Rasa NLU- Natural Language Understanding; Intent classification and entities extraction

Rasa Core-Dialogue management model which predicts what happens next in the conversation based on NLU and conversation story

Let us keep this short and head to building the chatbot. I hope you have already installed the latest version of RASA core and RASA NLU.

Add Natural Language Understanding

Step 1: Create a Data file which defines intents:

Create a project folder MMT. Under MMT, create two subfolders “data” and “config”. “data ” contains intent with examples and “config” contains .yml configuration file.

I have created a .md file under “data”. It can also be created in .json format. I have given four intents(flight,inform,affirmation,deny). We’ll determine the intent from user inputs. We have to train the NLU model by providing some examples for each intent.

Also, I have marked the entities for some of the user inputs such as location and date. (for e.g. [DEL](location) ‘DEL’ is the value while ‘location is the entity’).

Step 2: Create configuration file(.yml or .yaml)

The configuration file defines the pipeline which we are using. Incoming messages are processed by a sequence of components. These components are executed one after another in a so-called processing pipeline. There are components for entity extraction, for intent classification, pre-processing, and others. Each component processes the input and creates an output. The output can be used by any component that comes after this component in the pipeline.

We will discuss built-in pipelines and custom pipelines in coming sections.

Step 3: Train the NLU Model

Train the model with NLU data and config pipelines. The model gets saved inside models/nlu.

For evaluation, I parsed the question (“will I get latest flight info”) and confidence comes out to be 95% for the intent: flight. That means ,our model is trained well.

Now, I will train the RASA core or dialogue management model in the next section and try to run the bot on my local machine.


Github repo for the project: