Run and Develop Sherpa Slackbot#
The Sherpa repository contains the Sherpa code, including a chatbot built using Flask and Slack. The chatbot leverages the Langchain library for question-answering and text processing tasks. While you can talk to Sherpa in the AISC Slack workspace, if you want to go deeper and contribute to code or run Sherpa in your own Slack workspace then this section is for you.
Video tutorial#
Slackbot Features#
Receives events from Slack using SlackEventAdapter.
Handles app mentions and responds with a message.
Implements a conversational retrieval chain for question-answering.
Integrates with OpenAI GPT-3.5 Turbo for language modeling.
Utilizes Flask and FastAPI frameworks for building the web server.
Preparation#
Clone the repository:
git clone
Create new app in slack workspace following the setup tutorial
Configuration: Copy the contents of
src/.env-sample
into your ownsrc/.env
file, and then modify your configuration as needed. Remember not to share your private keys with anyone else.
Usage#
Run with docker#
Install Docker and docker-compose locally. Then, run the docker-compose, the setup, the sherpa-ai package, and the local vector database prefilled with the production data.
cd src/ docker-compose up -d
Expose the server to the internet using a tool like ngrok. This is not required if your server is hosted on a public IP address.
Set up the Slack app’s Event Subscriptions and provide the ngrok URL as the Request URL.
NOTE: When adding the url to the Slack app, make sure to append
/slack/events
at the end as this is the default path used by Slack Bolt.
Run with Virtual Environment#
If you want to use the local vector database, you need to build the vector database with Docker. See Setup Local VectorDB with Production Data for how to do this.
Create a new conda environment:
conda create -n slackbot python=3.9
Activate the environment:
conda activate slackbot
Install the dependencies of the slackbot:
Download the spaCy trained pipeline for English.
If you installed dependencies with Poetry in the previous step, run:
poetry run python -m spacy download en_core_web_sm
If you installed dependencies with pip, run:
python -m spacy download en_core_web_sm
Run the server:
Run with Poetry
poetry run sherpa_slack
Run the script directly
cd src/ python apps/slackapp/slackapp/bolt_app.py
Reference#
Once you have the chatbot running you can start interacting with it by mentioning the app in a Slack channel. See Talk to Sherpa for how to do this.
You can also configure a local vector database for the chatbot to use as a context search tool. See Setup Local VectorDB with Production Data