An open-source Discord bot, created using LlamaIndex, that -
- Listens to your server conversations
- Continuously learns from them
- Answers your questions from the entire server.
discord_llamabot_demo.mp4
It’s recommended to host this bot yourself for your server, but if you wanna try out first, you can invite the bot to your server through this link.
Tech stack used for this bot:
- LlamaIndex as the RAG framework
- Google Gemini Pro as the LLm and Embedding model
- Qdrant cloud as the vectorstore
- discord.py to setup the bot logic
- Finally deploy it to Replit
Checkout my blog post where I walk you through the entire process of building a full-fledged discord bot like this using LlamaIndex.
/llama
- Ask LlamaBot questions/listen
- Starts listening to messages across the server and remembers those./stop
- Stops listening to messages/forget
- Forgets all messages from the server/status
- Shows whether bot is listening to messages or not
$ git clone https://github.com/rsrohan99/llamabot.git
$ cd llamabot
Now set the following Environment variables:
DISCORD_API_TOKEN='...'
QDRANT_KEY='...'
QDRANT_URL='...'
GOOGLE_API_KEY='...'
# USE_OPENAI=true # set this to use gpt4, add OPENAI_API_KEY as well, set USE_OPENAI to '' to use Gemini Pro
# OPENAI_API_KEY='...'
If you wanna use GPT-4 to generate responses, then set USE_OPENAI
to 1 and add OPENAI_API_KEY
If you wanna use Cohere to generate responses, then set USE_COHERE
to 1 and add COHERE_KEY
Next run the program:
$ poetry install
$ poetry run python llamabot.py