This Discord bot is designed to interact with users on Discord servers. It can learn from text inputs and provide answers based on previous interactions. The bot uses the langchain library for its language processing capabilities and FAISS for efficient similarity search in large databases.
This repository contains a Colab notebook that demonstrates how to use the MemBot application. To open the notebook in your browser, click the "Open In Colab" button.
- Learn: The bot can learn from text inputs provided via the
/learncommand. - Ask: Users can ask questions using the
/askcommand, and the bot will attempt to provide relevant answers based on what it has learned.
Before running the bot, ensure you have the following prerequisites:
- Python 3.10 or higher
- A Discord Bot Token
- An OpenAI API Key
- Clone the repository:
- Install the required dependencies:
pip install -r requirements.txt
- Create a
.envfile in the root directory of your project. - Add your OpenAI API key and Discord Bot Token to the
.envfile:
OPENAI_API_KEY=your_openai_api_key_here
TOKEN=your_discord_bot_token_here
Execute the bot with the following command:
python main.py
The bot will create a new FAISS index on the first run if one doesn't exist.
/learn [text]: Teach the bot new information. Replace[text]with the content./ask [question]: Ask the bot a question. Replace[question]with your query.
The bot is configured to handle SIGINT (Ctrl+C) and SIGTERM signals to save the FAISS index state before exiting.
If you encounter any issues, verify that all environment variables are correctly set and you have a working internet connection. Check the terminal's error messages for more information.
Feel free to fork the repository, make your improvements, and submit a pull request.
This bot is released under the MIT License.