The bot will be implemented using the following technologies:
- Discord.py: A Python library for interacting with the Discord API. Discord.py Documentation
- Text Embeddings: Textual data will be converted into numerical representations for semantic analysis. Introduction to Text Embeddings
- Vector Database: Textual data will be stored in a vector database for efficient semantic search. Vector Database
- FastAPI: For building a web API to interface with the bot. FastAPI Documentation
- Docker: For containerization and deployment. Docker Documentation
- Celery (Optional): For task queue management and asynchronous processing. Celery Documentation -- RabbitMQ (Optional): Message broker for inter-component communication. RabbitMQ Documentation
We follow a 'learn as you do' motto, so don’t hesitate to pick up issues that interest you, even if you're unfamiliar with the details. Support is always available!
git clone https://github.com/UB-AICLUB/RagBot.git
cd RagBot
Each module has its own virtual environment and dependencies. You'll need to set up each environment individually based on the module you're working on.
Navigate to the API directory:
cd API
Create a virtual environment and install the necessary Python packages:
python -m venv .venv
source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
pip install -r requirements.txt
Ensure that the .env file is set up with any required environment variables for the API.
Navigate to the client directory:
cd client
Create a virtual environment and install the necessary Python packages:
python -m venv .venv
source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
pip install -r requirements.txt
Set up your Discord bot token and any other necessary configuration by creating a .env file:
DISCORD_TOKEN=your_discord_token
This file is required only if you want to test the bot on your server
If you're working with the task queue module, navigate to the directory:
cd task_queue
Set up the environment and install dependencies as needed following the pattern used for the other modules.
This will spin up all services, including the API and client components.
We use global linting and formatting rules across all modules. Make sure to follow them by running the linters and formatters from the root directory.
After cloning the repository and installing dependencies from requirements.txt
, make sure to install pre-commit hooks:
pre-commit install
To check for linting issues:
flake8 .
To automatically format code:
black .
To check all pre-commit issues
pre-commit run --all-files
Ensure you follow these rules before making a pull request.
To run the FastAPI server for the API module, navigate to the API directory and run:
uvicorn main:app --reload
The API will now be available at http://127.0.0.1:8000.
To run the Discord bot, navigate to the client directory and execute:
python main.py
You can easily start the entire application using Docker Compose. This will launch all necessary services defined in your docker-compose.yaml file.
From the root directory, execute the following command:
docker-compose up --build
This command will build and start all services, including the API and client components, allowing you to run the application seamlessly.
Make sure you have Docker and Docker Compose installed on your machine before executing this command.