Here’s the corrected version of your text with spelling and grammatical mistakes fixed:
This repo contains the code for UltraChat, a Discord bot aimed at boosting productivity in highly active Discord servers where keeping up with chat is imperative but difficult to do simultaneously.
With common Discord bot functionality, such as moderation tools and some fun commands for memes and random interests like cryptography, it also includes features for chat summaries and querying based on all collected chats within a certain server. The summaries are then stored in a database for future use.
The summary engine for this bot is built using LangChain, leveraging a mix of map-reduce and clustering to handle extremely large quantities of text. The summarization engine follows these steps:
- Collection: The text within the chats is collected and passed to the summarization engine.
- Chunking: The text is split into chunks of a given length.
- Embedding Generation: These chunks are processed through an embedding model (embed-english-v3.0 via Cohere) to generate their corresponding vector embeddings, which store the semantic meaning of the chunks.
- Clustering: The chunks are clustered via K-Means clustering (where every 9 chunks are clustered together, with a maximum of 11; these numbers were chosen somewhat arbitrarily).
- Map-Reduce: The most central chunk of each cluster is chosen as the average of the clusters and summarized individually. All these summaries are then combined and summarized again.
While this method may result in some loss of detail, making it a poor choice for needle-in-a-haystack problems, it is highly efficient for general summarization tasks. By grouping similar text into clusters and selecting the most relevant chunk to summarize, the engine significantly reduces processing time and cost, as less text needs to be handled by the LLM.
For cases where specific questions need to be answered, all stored chats and their respective vector embeddings are stored in a vector database (ChromaDB) for quick querying via a RAG (Retrieval-Augmented Generation) pipeline. Read more about RAG here.
The LLMs used are hosted on Groq, which provides incredibly high inference speeds. The LLaMA family of models was chosen due to their strong performance among open-source models.
You need to have Python installed along with a Discord developer account. Visit the Discord Developer Portal, create a bot application, and obtain its token.
Clone the repository using:
git clone https://github.com/GDGVIT/ultra-chat-bot.git
cd ultrachat
Check .env.example
and obtain all the required API keys:
Ensure that the UltraChat backend is hosted and provide the respective endpoints.
Rename .env.example
to .env
, which will contain all the required client secrets.
python -m venv venv
.\venv\Scripts\activate
source venv/bin/activate
It is recommended to use Python >= 3.10.
pip install -r requirements.txt
python app.py
Ensure Docker is installed on your system.
Make sure all credentials are properly set in the .env
file as described earlier.
docker-compose build
docker-compose up
Once the bot is running, obtain the bot's invite link (OAuth2 URL) from the Discord Developer Portal, invite it to your server, and run the !help
command to get a list of available commands and start using UltraChat! 🚀
Noel Alex |
Sidhant Srivastav |
Made with ❤ by GDSC-VIT