A chatbot framework which organically learns to handle the most frequently asked questions.
This code was developed by the AXA REV research team to serve as prototype for a chatbot framework to handle frequently asked questions about a topic or a product.
Main features:
- Built-in NLP engine based on fastText for text classification
- Seamless WebSocket integration using Action Cable
- Instant embedding of chat window on any page thanks to customizable widget code
- Dynamic answers using global variables, user variables and external APIs
- Optional connection with Facebook messenger
- Optional feedback loop for auto-approvements
- Multi-tenancy: Operate multiple chatbots within one framework
- User authentication using Devise and role-based user authorization using cancancan
- Ruby 2.4.1+
- bundler,
gem install bundler
- A database, e.g. MySQL, PostgreSQL, Oracle
Clone the respository and install the required gems:
bundle install
Generate secret keys for the development
and test
sections in config/secrets.yml:
rake secret
Create the database and load the schema:
rake db:setup
Open the Rails console with rails c
and create your admin account:
User.create(email: "[email protected]", password: "TOPSECRET_PASSWORD", password_confirmation: "TOPSECRET_PASSWORD", role: "admin")
Startup your local web server:
rails s
Login in at http://localhost:3000 and create your first FAQ bot project.
- Install fastText in your environment
- In config/classifiers.yml, provide the path to the binary, the path to the directory of pretrained vectors, and the path to the directory where you would like to save the classifiers
- Download the text files of pretrained vectors for all languages of your interest to the directory of pretrained vectors
- Create a Facebook page and setup a Facebook app
- In the Messenger section, create a page access token and add it to the settings of your FAQ bot project
- In the Webhooks section, edit the page subscription and provide your app's callback url and a random verification token
- Add the token to your FAQ bot project's settings to complete the integration
For testing in your development environment, you will need to expose the Webhook url of your local server to the internet. This can be achieved using Ngrok.
Most FAQ knowledge bases are static. In the present chatbot framework, the knowledge base grows organically based on real user demand. The workflow is semi-automated: In the beginning the questions are handled by an agent. The answer to a new question which has never been asked before is manually provided by a human (1). In the following, similar questions by other users are addressed by the agent by selecting the answer from a list (2). Over time the chatbot learns and eventually replies automatically (3).
Additional information about how to configure the chatbot framework can be found in the wiki.
For questions, please contact [email protected].
Copyright (c) GIE AXA Services France SAS
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.