interdisciplinary project HS Osnabrueck
Creating a rasa chatbot to answer FAQs and manage event registration for Kompetenzzentrum 4.0 Lingen
- Download the install script for Rasa X either for a specific version
curl -sSL -o install.sh https://storage.googleapis.com/rasa-x-releases/1.0.1/install.sh
or edge version
curl -sSL -o install.sh https://storage.googleapis.com/rasa-x-releases/latest/install.sh
- Install Rasa X
sudo bash ./install.sh
- Start up Rasa X in the Backround
cd /etc/rasa
sudo docker-compose up -d
- Set up your password
cd /etc/rasa
sudo python3 rasa_x_commands.py create --update admin me <PASSWORD>
For more Information also see: (https://rasa.com/docs/rasa-x/installation-and-setup/install/docker-compose/)
-
Start Rasa X within your webbrowser and navigate to the "Connect to a reposetory" option
-
Clone your Git Repos URL with SSH and paste it in the "SSH for repository" field in Rasa X
-
For the filed "Target branch" choose "master"
-
Copy the SSH deply key from Rasa X and paste ist into your Git Repos Settings/Deploy keys. Title the key and give write accsess
-
Press "Verify connection" Button
- Download the Rasa X Docker-compose.yml (in this case for Version == 1.0.1)
wget -qO docker-compose.yml https://storage.googleapis.com/rasa-x-releases/1.0.1/docker-compose.ce.yml
- Create a directory for the Rasa-Sevice Dockerfile (e. g. "rasa-service")
sudo mkdir rasa-service
- Within the directrory create a Dockerfile
sudo nano Dockerfile
- Paste this code to extend the Dockerimage with Spacy
ARG RASA_IMAGE
FROM ${RASA_IMAGE}
USER root
RUN pip install -U pip setuptools wheel
RUN pip install -U spacy
RUN python -m spacy download de_core_news_lg
USER 1001
- Create a directory for the Rasa-Action Dockerfile (e. g. "rasa-action")
sudo mkdir rasa-action
- Within the directrory create a Dockerfile
sudo nano Dockerfile
- Paste this code to extend the Dockerimage for the Action Server
# Extend the offical Rasa SDK image
FROM rasa/rasa-sdk:2.8.2
# Use Subdirectory as working directory
WORKDIR /app
# Copy any additional custom requirements, if necesarry (uncomment next line)
# COPY actions/requirements.txt ./
# Change User
USER root
# Install extra reqirements for actions, if necesarry (uncoment next line)
# RUN pip install -r requirements.txt
# Copy actions folder to working directory
COPY ./actions /app/actions
# Change User
USER 1001
- Within the rasa-action folder create a subfolder 'actions' for all custom actions files and the requirements.txt file. Paste the Pythone code into the files and the required libraries into the .txt file
cd etc/rasa/rasa-actions
sudo mkdir actions
sudo nano actions/actions.py
sudo nano actions/__init__.py
sudo nano actions/requirements.txt
- Change permissions for rasa-service and rasa-action respectively
sudo chmod 775 -R rasa-service
sudo chmod 775 -R rasa-action
- In the docker-compose.yml file, adapt the x-rasa-services: &default-rasa-service section
x-rasa-services: &default-rasa-service
build:
context: ./rasa-service
args:
RASA_IMAGE: "rasa/rasa:${RASA_VERSION}-full"
restart: always
volumes:
- ./.config:/.config
.....
- In the docker-compose.yml file, adapt the app section
app:
build:
context: ./rasa-action
restart: always
expose:
- "5055"
depends_on:
- rasa-production
- Rebuild the Docker image
sudo docker-compose down
sudo docker-compose build
sudo docker-compose up -d
- Create a virtual enviroment with python version 3.7
conda create --name tabalurasa python==3.7
- Activate the virtual enviroment
conda activate tabularasa
- Use an older version of pip due to backtracking runtime issue (https://stackoverflow.com/questions/65122957/resolving-new-pip-backtracking-runtime-issue)
python -m pip install --upgrade pip==20.2
- Install rasa
pip install rasa
-
Copy this repository https://support.atlassian.com/bitbucket-cloud/docs/clone-a-git-repository/
-
Open the project in your favourite IDE
-
Create a settings.json in the project directory (root) with the following content:
{
"python.pythonPath": "C:\\XXXXX\\XXXXX\\XXXXX\\XXXXX\\python.exe",
"terminal.integrated.shell.windows":"C:\\Windows\\System32\\cmd.exe",
"terminal.integrated.shellArgs.windows": ["/K", "C:\\XXXXX\\XXXXX\\XXXXX\\activate.bat C:\\XXXXX\\XXXXX\\XXXXX\\tabularasa"]
}
- Adjust the path to the corresponding files e.g.:
{
"python.pythonPath": "C:\\DEV\\miniconda3\\envs\\tabularasa\\python.exe",
"terminal.integrated.shell.windows":"C:\\Windows\\System32\\cmd.exe",
"terminal.integrated.shellArgs.windows": ["/K", "C:\\DEV\\miniconda3\\Scripts\\activate.bat C:\\DEV\\miniconda3\\envs\\tabularasa"]
}
- Install spacy for advanced natural language processing
pip install spacy
- Check your rasa version
rasa --version
This is my output:
This is my output:
Rasa Version : 2.8.16
Minimum Compatible Version: 2.8.9
Rasa SDK Version : 2.8.2
Rasa X Version : 1.0.1
Python Version : 3.7.11
Operating System : Windows-10-10.0.19041-SP0
Python Path : c:\dev\miniconda3\envs\tabularasa\python.exe
- Train the rasa model
rasa train
- Interact with the bot via terminal
rasa shell
For more information see the official rasa documentation: https://rasa.com/docs/rasa/
-
Use the network of the hs osnabrück (e. g. via eduVPN)
-
Open 131.173.65.71/login in your favourite browser and login with credentials
The UI is build with rasa webchat. A chat widget to deploy virtual assistants made with rasa or botfront on any website.
For more information see the rasa webchat project: https://github.com/botfront/rasa-webchat
The script which contains the body, the parameters and other features you will find here:
index.html
- Access Rasa X server (see above)
- Open the container bash for navigation (replace the with the current id of the application container)
docker container exec -it <CONTAINERID> bash
- View the content of the file by
cat ratings.csv
- Close the bash with CTRL + D
- Access Rasa X server (see above)
- Copy the file to your Local System (replace the with the current id of the application container)
sudo docker cp <CONTAINERID>:app/ratings.csv ~/ratings.csv
- Navigate to copied file, where you will find the ratings
cd home/tabula
We recommend to access the ratings.csv from outside the container.