All Projects → RasaHQ → Financial Demo

RasaHQ / Financial Demo

Licence: apache-2.0
A demo for a financial services bot

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Financial Demo

Whaticket
A very simple Ticket System based on WhatsApp messages, that allow multi-users in same WhatsApp account.
Stars: ✭ 120 (-9.09%)
Mutual labels:  bot
Instagram Tools
Node.JS Instagram Tools
Stars: ✭ 127 (-3.79%)
Mutual labels:  bot
Registrator.jl
Julia package registration bot
Stars: ✭ 130 (-1.52%)
Mutual labels:  bot
Bot
An open-source and self-hosted ticket management bot for Discord - a free alternative to the premium and white-label plans of other popular ticketing bots.
Stars: ✭ 122 (-7.58%)
Mutual labels:  bot
Neuro
🔮 Neuro.js is machine learning library for building AI assistants and chat-bots (WIP).
Stars: ✭ 126 (-4.55%)
Mutual labels:  bot
Sharpbot
A Discord.js selfbot written by Rayzr - 60 second installation!
Stars: ✭ 127 (-3.79%)
Mutual labels:  bot
Telegram Robot Rss
A clean and easy to use RSS Newsfeed Bot for fabulous Telegram Messenger App! 🤖 ✉️ ❤️
Stars: ✭ 120 (-9.09%)
Mutual labels:  bot
Calypsobot
A fully customizable bot built with discord.js
Stars: ✭ 131 (-0.76%)
Mutual labels:  bot
Tsn Ranksystem
A PHP Bot that assigns time based server groups on TeamSpeak3.
Stars: ✭ 124 (-6.06%)
Mutual labels:  bot
Tiktokbot
A TikTokBot that downloads trending tiktok videos and compiles them using FFmpeg
Stars: ✭ 126 (-4.55%)
Mutual labels:  bot
Go Cqhttp
cqhttp的golang实现,轻量、原生跨平台.
Stars: ✭ 3,481 (+2537.12%)
Mutual labels:  bot
Discord.js
discord.js is a powerful Node.js module that allows you to easily interact with the Discord API.
Stars: ✭ 16,432 (+12348.48%)
Mutual labels:  bot
Instalike Instagram Bot
automate instagram activities using instagram bot - like follow/unfollow comment; python requests lib
Stars: ✭ 128 (-3.03%)
Mutual labels:  bot
Kuku Bot
基于YuQ-Mirai的机器人
Stars: ✭ 120 (-9.09%)
Mutual labels:  bot
Phptrader
A simple php powered Bitcoin and Ethereum trading bot
Stars: ✭ 131 (-0.76%)
Mutual labels:  bot
Open Bounty
Enable communities to distribute funds to push their cause forward.
Stars: ✭ 121 (-8.33%)
Mutual labels:  bot
Botbuilder Java
The Microsoft Bot Framework provides what you need to build and connect intelligent bots that interact naturally wherever your users are talking, from text/sms to Skype, Slack, Office 365 mail and other popular services.
Stars: ✭ 127 (-3.79%)
Mutual labels:  bot
Telegram Forward Bot
Simple Telegram Bot for forwarding messages easily between various related channels and groups.
Stars: ✭ 132 (+0%)
Mutual labels:  bot
Framework
Chatbot framework
Stars: ✭ 130 (-1.52%)
Mutual labels:  bot
Discord Haskell
Haskell library for writing Discord bots
Stars: ✭ 129 (-2.27%)
Mutual labels:  bot

Notes on Rasa 2.x / 1.x

  1. The master branch of this repo is compatible with Rasa Open Source version 2.x
  2. The bot for Rasa 1.x can be found in the rasa-1 branch.

Financial Services Example Bot

This is an example chatbot demonstrating how to build AI assistants for financial services and banking. This starter pack can be used as a base for your own development or as a reference guide for implementing common banking-industry features with Rasa. It includes pre-built intents, actions, and stories for handling conversation flows like checking spending history and transferring money to another account.

Table of Contents

Install dependencies

Run:

pip install -r requirements.txt

To install development dependencies:

pip install -r requirements-dev.txt
pre-commit install
python -m spacy download en_core_web_md en
python -m spacy link en_core_web_md en

With pre-commit installed, the black and doctoc hooks will run on every git commit. If any changes are made by the hooks, you will need to re-add changed files and re-commit your changes.

Run the bot

Use rasa train to train a model.

Then, to run, first set up your action server in one terminal window, listening on port 5056:

rasa run actions --port 5056

Note that port 5056 is used for the action server, to avoid a conflict when you also run the helpdesk bot as described below in the handoff section.

In another window, run the duckling server (for entity extraction):

docker run -p 8000:8000 rasa/duckling

Then to talk to the bot, run:

rasa shell --debug

Note that --debug mode will produce a lot of output meant to help you understand how the bot is working under the hood. To simply talk to the bot, you can remove this flag.

You can also try out your bot locally using Rasa X by running

rasa x

Refer to our guided workflow in the Wiki page for how to get started with Rasa X in local mode.

Overview of the files

data/nlu/nlu.yml - contains NLU training data

data/nlu/rules.yml - contains rules training data

data/stories/stories*.yml - contains stories training data

actions.py - contains custom action/api code

domain.yml - the domain file, including bot response templates

config.yml - training configurations for the NLU pipeline and policy ensemble

tests/ - end-to-end tests

Things you can ask the bot

The bot currently has five skills. You can ask it to:

  1. Transfer money to another person
  2. Check your earning or spending history (with a specific vendor or overall)
  3. Answer a question about transfer charges
  4. Pay a credit card bill
  5. Tell you your account balance

It also has a limited ability to switch skills mid-transaction and then return to the transaction at hand.

For the purposes of illustration, the bot recognises the following fictional credit card accounts:

  • emblem
  • justice bank
  • credit all
  • iron bank

It recognises the following payment amounts (besides actual currency amounts):

  • minimum balance
  • current balance

It recognises the following vendors (for spending history):

  • Starbucks
  • Amazon
  • Target

You can change any of these by modifying actions.py and the corresponding NLU data.

If configured, the bot can also hand off to another bot in response to the user asking for handoff. More details on handoff below.

Handoff

This bot includes a simple skill for handing off the conversation to another bot or a human. This demo relies on this fork of chatroom to work, however you could implement similar behaviour in another channel and then use that instead. See the chatroom README for more details on channel-side configuration.

Using the default set up, the handoff skill enables this kind of conversation with two bots:

Try it out

The simplest way to use the handoff feature is to do the following:

  1. Clone chatroom and Helpdesk-Assistant alongside this repo
  2. In the chatroom repo, install the dependencies:
yarn install
  1. In the chatroom repo, build and serve chatroom:
yarn build
yarn serve
  1. In the Helpdesk-Assistant repo, install the dependencies and train a model (see the Helpdesk-Assistant README)
  2. In the Helpdesk-Assistant repo, run the rasa server and action server at the default ports (shown here for clarity) In one terminal window:
    rasa run --enable-api --cors "*" --port 5005 --debug
    
    In another terminal window:
    rasa run actions --port 5055 --debug
    
  3. In the Financial-Demo repo (i.e. this repo), run the rasa server and action server at the non-default ports shown below In one terminal window:
    rasa run --enable-api --cors "*" --port 5006 --debug
    
    In another terminal window:
    rasa run actions --port 5056 --debug
    
  4. Open chatroom_handoff.html in a browser to see handoff in action

How it works

Using chatroom, the general approach is as follows:

  1. User asks original bot for a handoff.
  2. The original bot handles the request and eventually sends a message with the following custom json payload:
        {
            "handoff_host": "<url of handoff host endpoint>",
            "title": "<title for bot/channel handed off to>"
            }
    
    This message is not displayed in the Chatroom window.
  3. Chatroom switches the host to the specified handoff_host
  4. The original bot no longer receives any messages.
  5. The handoff host receives the message /handoff{"from_host":"<original bot url">}
  6. The handoff host should be configured to respond to this message with something like, "Hi, I'm , how can I help you??"
  7. The handoff host can send a message in the same format as specified above to hand back to the original bot. In this case the same pattern repeats, but with the roles reversed. It could also hand off to yet another bot/human.

Bot-side configuration

The "try it out" section doesn't require any further configuration; this section is for those who want to change or further understand the set up.

For this demo, the user can ask for a human, but they'll be offered a bot (or bots) instead, so that the conversation looks like this:

For handoff to work, you need at least one "handoff_host". You can specify any number of handoff hosts in the file actions/handoff_config.yml.

handoff_hosts:
    helpdesk_assistant:
      title: "Helpdesk Assistant"
      url: "http://localhost:5005"
    ## you can add more handoff hosts to this list e.g.
    # moodbot:
    #   title: "MoodBot"
    #   url: "http://localhost:5007"

Handoff hosts can be other locally running rasa bots, or anything that serves responses in the format that chatroom accepts. If a handoff host is not a rasa bot, you will of course want to update the response text to tell the user who/what they are being handed off to.

The Helpdesk-Assistant bot has been set up to handle handoff in exactly the same way as Helpdesk-Assistant, so the simplest way to see handoff in action is to clone Financial-Demo alongside this repo.

If you list other locally running bots as handoff hosts, make sure the ports on which the various rasa servers & action servers are running do not conflict with each other.

Testing the bot

You can test the bot on the test conversations by:

  • start duckling
  • running rasa test.

This will run end-to-end testing on the conversations in tests/test_stories.yml.

All tests must pass.

Rasa X Deployment

To deploy financial-demo, it is highly recommended to make use of the one line deploy script for Rasa X.

As part of the deployment, you'll need to set up git integration to pull in your data and configurations, and build or pull an action server image.

Action Server Image

You will need to have docker installed in order to build the action server image. If you haven't made any changes to the action code, you can also use the public image on Dockerhub instead of building it yourself.

See the Dockerfile for what is included in the action server image,

To build the image:

docker build . -t <name of your custom image>:<tag of your custom image>

To test the container locally, you can then run the action server container with:

docker run -p 5055:5055 <name of your custom image>:<tag of your custom image>

Once you have confirmed that the container works as it should, you can push the container image to a registry with docker push

It is recommended to use an automated CI/CD process to keep your action server up to date in a production environment.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].