Food Ordering Chatbot using RASA.
Clone the repo.
- Install Anaconda3
- Create Environment and install requirements and activate the environment
$conda create --name <env-name> --file requirements.txt
Main Bot file to run:
$python bot.py
Some points about RASA:
- Requires installations of multiple components
- Requires tech knowledge
- Open-source
- No interface needed, can write down in json or md format
- Host the data or bot on our own server
First let's define how our chatbot should converse like. Just a flow diagram.
-
training_data: these are the stories that define the normal converation.
## Generated Story -7329490837376575624 * greetings.hello - utter_greetings.hello - utter_agent.welcome - utter_ask.cuisine * cuisine.type{"cuisine": "mexican"} - slot{"cuisine": "mexican"} - utter_display.menu - utter_select.item * confirm.affirm - utter_order.placed
-
domains: this defines the environment in which bot operates. It specifies
intents
,entities
,slots
,actions
the bot should know about andtemplates
for the things bot can say. -
load_agent: bot is first loaded with some parameters to determine how the stories and other data can be converted into features for training the bot.
-
policies: this is one of the parameter in load_agent. The policy decides which action to take at every step in the conversation. Find more about policies here. Note: tensorflow_embedding pipeline can be used to assign two or more intents to a single input message.
-
load_data: you load the data using the stories training file and defined domain file.
-
training: policies work in ensemble, we can pass more than 1 policy, it will train separately and will be used together in ensemble for prediction.
-
persist: when model is trained, it is then persisted to some storage.
- load model: first task is to load the trained model.
- start_server: we can user Flask.
- interpreter: it's job is to classify the intent with entity extraction and these entities can be used as slots in the conversation.
- create_tracker: this is created to track all the objects of a key say user_id. To make it easy to use slots of a particular user_id. RASA has inbuilt Memory Tracker. We can use MongoTrackerStore when scaling up.
- create_features: create freatures of the objects present in tracker based on the policy
- policy_ensemble: if we have more than one policy, each policy will output a score and max is taken to determine the next action
- update_tracker: once the action is performed, we will update the tracker.
- bot_text: the bot message to user (the action).
The code is provide here : github/food-ordering-chatbot
- database for item availability
- storage to keep order until it's placed/confirmed.
- storage to keep user's data (id, name, phone-number, address, previous orders)
- payment gateway/wallet
- notifications : can be a genral notification or for some coupons/codes
- assigned person for delivery ( to update on chatbot) ( person_name, phone-number)
- Flask web app
I will include basic flask application for chatting with the bot.