Skip to content

richkirk1/rasa-chatbot

Repository files navigation

rasa-chatbot

Installation (First Time Setup)

  • Git clone from repo

    git clone https://github.com/richkirk1/rasa-chatbot.git [<directory>]
    
  • Create virtual environment

    python3 -m venv .venv
    
  • Activate virtual environment

    source .venv/bin/activate
    
  • Install required dependencies (including rasa & node.js)

Rasa

pip install --upgrade pip
pip install -r requirements.txt
python3 -m spacy download en_core_web_md
pip install -e .

Meilisearch

curl -L https://install.meilisearch.com | sh

https://docs.meilisearch.com/learn/getting_started/quick_start.html

Node.js

npm install 

Usage (How to Run this chatbot)

Rasa

To train a model, use rasa train (this will take a significant amount of time; if you wish to train it faster, try the command with --augmentation 0).

First set up the action server in a separate terminal window:

rasa run actions

These are custom actions that require connections to external services and what not.

In another terminal window, run the bot:

rasa shell --debug

In the last terminal window, run meilisearch:

./meilisearch

The --debug flag produces a lot of output meant to help understand how the bot is working under the hood. To have a normal conversation, run without the --debug flag.

Interface

To run the interface you will need three seperate terminals.

First set up the action server:

rasa run actions

In the second terminal we will need run rasa on a live server.

rasa run --cors "*"

In the third terminal window we will set up a local server for the interface to run. It is important that you are within the interface directory when running this command.

npm start

Testing

After running rasa train, run the command:

rasa test core
rasa test nlu

Postman

Postman is a service for testing APIs, is useful for testing Rasa custom actions and Rasa forms.

Here is a Postman team invite link:

https://app.getpostman.com/join-team?invite_code=ae63c809e8616e50c5c94b91255b829f&target_code=41bbf45353989a78c905f0cf2ea92392

To test with postman, first run the actions server:

rasa run actions

In another terminal window, run the bot server:

rasa run --enable-api --debug

Then, in the postman UI, you can run tests on the Collections (https://learning.postman.com/docs/running-collections/intro-to-collection-runs/).

File Overview

data/ - contains stories, rules, and nlu (training data)

actions/ - contains custom action code

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

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

Deployment

GCP STEPS

  1. Create a new project
  2. Create a brand spanken new vm
  3. Reserve static ip for vm
  4. Set UNSAFE firewall rule (can fix later)
  5. Create new rule w/ properties:
    • Target: all instances
    • Direction: ingress
    • Source IP ranges: 0.0.0.0/0
    • Ports and protocols: allow all

VM STEPS

  1. Update and upgrade
    • sudo apt update
    • sudo apt upgrade
  2. Install git
    • sudo apt install git
  3. Clone the relevant repository
    • git clone [URL]
  4. Install docker
    • sudo apt install docker
  5. Train model & build rasa-server WARNING: High Server Impact
    • sudo docker build -t rasa:latest .
  6. Build action-server
    • sudo docker build -t actions:latest ./actions
  7. Build the react interface and apache-server
    • sudo docker build -t interface:latest ./interface
  8. Create Docker Network
    • sudo docker network create deployment-network
  9. Run meli-server
    • sudo docker run -it -d --rm --network deployment-network -p 7700:7700 --name meili-server -v $(pwd)/meili_data:/meili_data getmeili/meilisearch:v1.1
  10. Run actions server - sudo docker run -d --rm -v "$PWD"/actions:/app/actions --network deployment-network -p 5055:5055 --name action-server actions:latest
  11. Run Rasa server - sudo docker run -it -d --rm --network deployment-network -p 5005:5005 --name rasa-server rasa:latest
  12. Run apache server - sudo docker run -d --rm --name apache-container -p 80:80 interface:latest

Helpful Docker commands:

  • List containers
    • sudo docker container ls -a
  • Destroy all containers
    • sudo docker rm -f $(sudo docker ps -a -q)
  • Check used docker space
    • sudo du -sh /var/lib/docker
  • Destroy EVERYTHING
    • sudo docker system prune -a -f --volumes

Development

To develop code for this bot:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published