Configurable Chatbot for support of different tasks in Jupyter Lab.
This branch (main) supports data science analysis in Jupyter Lab. If you are interested in the chatbot configured for teaching computational thinking and programming, please check the education branch.
This extension is composed of a Python package named newtonchat
for the server extension and a NPM package named newtonchat
for the frontend extension.
Currently, the chatbot only has hardcoded messages that use regex to match user input and a super user mode that is designed to be executed with the Wizard of Woz (see woz.md). Using regex for a conversational agent is not the best option, since it is too strict to consider nuances in natural language processing. The Wizard of Woz studies will allow us to model end-user expectations and dialog flows to create a better experience that uses large language models.
- JupyterLab >= 3.0
Currently, it is only possible to install the chatbot in development mode. In this mode, you will need NodeJS to build the extension package. For all the details on the development installation mode, please check CONTRIBUTING.md.
Run the commands below to install the chatbot:
# Clone and change into repository
git clone git@github.com:EPICLab/DSChatbot.git
cd DSChatbot
# Install package in development mode
pip install -e .
# Link your development version of the extension with JupyterLab
jupyter labextension develop . --overwrite
# Server extension must be manually installed in develop mode
jupyter serverextension enable newtonchat
# Rebuild extension Typescript source after making changes
jlpm run build
Now, you can execute Jupyter Lab to use it:
jupyter lab
In the future, we will add the option to install the chatbot from PyPI without requiring NodeJS with the following command:
pip install newtonchat
To remove the extension, execute:
pip uninstall newtonchat
If you are seeing the frontend extension, but it is not working, check that the server extension is enabled:
jupyter server extension list
If the server extension is installed and enabled, but you are not seeing the frontend extension, check the frontend extension is installed:
jupyter labextension list
The root of the Python package is the directory newtonchat
. It has 3 main directories:
-
data has json files that define regexes for hard-coded messages and subjects for auto-complete actions. Both files refer to states defined in code/states
-
bots is the module the handles the chatbot processing. It defines multiple bot instances. The main one is Newton, which defines multiple handlers on the handlers submodule and multiple states on the code/states submodule. The main orchestrator file is newton.py
-
loader is the module that defines loaders for the existing bots.
-
comm is the module that handles the communication between the frontend extension and the core orchestrator. It uses Jupyter Comm and redirects the messages to proper orchestrator methods.
The root of the frontend extension is the directory src
. It is divided into three parts. The displayed components use Svelte components stored at the components directory. The communication with the Python server extension uses the dataAPI directory. Finally, the remaining files of the extension manage the execution of the Jupyter extension and provide a bridge among these elements.