A rasa open source chatbot that takes user queries and returns the best restaurants in the area using Zomato API
Zomato has stopped the support for the API, hence this solution might not work anymore.
https://twitter.com/zomatocare/status/1391288230818029571?s=21
- python 3.7.0
- rasa 1.3.9
- spacy 2.1.4
- en_core_web_md 2.1.0
Refer to official installation guide to install RASA
-
Package Installation
pip install -U spacy
-
Model Installation
python -m spacy download en_core_web_md
-
Create custom shortcut link to Spacy model
python -m spacy link en_core_web_md en
This repo contains training data and script files necessary to compile and execute this restaurant chatbot. It comprises of the following files:
- data/nlu/nlu.md : contains training examples for the NLU model
- data/core/stories.md : contains training stories for the Core model
- zomato : contains Zomato API integration code
- zomato_api.py : contains functions to consume common Zomato APIs like fetch location details, type of cuisines, search for restaurants, etc
- zomato_test.py : contains 3 test functions for Zomato API - location details, cuisine details and restaurant search
- action_api_test.py : executes Zomato API test functions from command line
- actions_server.py : contains code to start a RASA actions server. This is used to serve RASA custom actions.
- actions.py : contains the following custom actions (insert ZOMATO API key in this script file before starting RASA server)
- search restaurant
- validate location
- validate cuisine
- send email
- restart conversation
- reset slots
- nlu_test.py : contains code to test generated NLU models
- nlu_train.py : contains code to
- train a NLU model
- persist NLU model in 'models' folder
- run CLI to interact with generated model and validate extracted intents and entities
- rasa_slack.py : contains code to integrate with slack channel
- rasa_train.py : primary script file to test chatbot from CLI. Contains code to:
- train both NLU and Core model
- persist packaged model in 'models' folder
- start CLI interface to interact with chatbot (RASA action server must be running for this to work)
- config.yml contains model configuration and custom policy
- credentials.yml contains authentication token to connect with channels like slack
- domain.yml defines chatbot domain like entities, actions, templates, slots
- endpoints.yml contains the webhook configuration for custom action
- smtpconfig.txt contains SMTP server configuration information (If using GMAIL, setup account and generate app password) .
rasa run actions
rasa shell
rasa shell nlu
python3 rasa_train.py
MODEL FILE is saved in models folder: (models/restaurant_rasa_model.tar.gz)
NOTE: Both nlu and core model are saved inside one model file, i.e models/restaurant_rasa_model.tar.gz
* DEFAULT : separate test set is created
* VALIDATION : uses cross - validation
bash python3 nlu_test.py --type DEFAULT
bash python3 nlu_test.py --type VALIDATION