This repo is a work in progress. It demonstrates a music chatbot that can converse with users about music use cases.
The following functionality is currently coverered:
- music recommendations via artist
- music recommendations via song title
- Album Release Date Questions
- Album Tracklist Questions
- Artist Biography Questions
Check if your Python env is already configured python3 --version pip3 --version
Mac Instructions. For Windows or Linux, please see here: https://rasa.com/docs/rasa/installation/environment-set-up
- Install homebrew if you haven't already (https://brew.sh/)
- Update homebrew: brew update
- brew install python
- See https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository for more details.
How to set up
- Create a virtual env using python 3.9: python3.9 -m venv ./venv
- Activate the virtual env: source ./venv/bin/activate
- Make sure pip is up to date: pip3 install -U pip
- Install rasa: pip3 install rasa
- Install other requirements: pip install -r requirements.txt
- Next you need to set up your client credentials, see the next section
- Go to the .env.example file in the root directory
- Rename .env.example to .env
- Add the credentials in for each. The services needed are listed below:
- pip install streamlit
- Check it is working (streamlit will launch in a browser window): streamlit hello
- To stop the Streamlit server, press: ctrl-C
- Press deactivate if you want to exist the venv
-
Run the rasa server: rasa run -m models --enable-api --cors="" or rasa run -m models --enable-api --cors="" --debug
- we use --cors"*" (Cross Origin Resource Sharing) to allow all traffic to connect. In production we set cors to only accept requests from specific origins
-
Split terminal
-
Run the action server rasa run actions (make sure you are in the correct folder!)
-
Split terminal again
-
In the new split terminal, run the streamlit app (make sure you are in the correct folder, cd streamlit): streamlit run main.py
-
The app will launch in a new window!
-
Alternatively; just run this to test the bot in the command line: rasa shell nlu
- Make changes
- Run: rasa train
- Use above steps
- Run: pytest
- Run: rasa test --stories tests/test_stories.yml
This will perform NLU model evaluation with cross-validation by splitting the training data into multiple sets and training/testing the model several times to get an average performance metric
- run: rasa test nlu --cross-validation
This will test:
- NLU evaluation: how well the model classifies intents and extracts entities based on the provided examples in the NLU training data using metrics such as precision, recall, and f1-score for intents and entities
- Dialogue Management (Core): tests stories and rules
- [Not utilising] End to End testing: test conversations if end-to-end examples are place in the tests/ directory
- run: rasa test