Skip to content

This project is a modular pipeline for retrieval-augmented generation (RAG) using Discord, FastAPI, ChromaDB, Ollama, and n8n. It enables capturing Discord messages, embedding and storing them in a vector database, and generating context-aware responses using LLMs.

License

Notifications You must be signed in to change notification settings

ethan-mcmanus-dev/Retrieval-Augmented-Generation-Study-Discord-Bot

Repository files navigation

Retrieval-Augmented Generation Study Discord Bot

This project is a modular pipeline for retrieval-augmented generation (RAG) using Discord, FastAPI, ChromaDB, Ollama, and n8n. It enables capturing Discord messages, embedding and storing them in a vector database, and generating context-aware responses using LLMs.

Key Components

  • Discord Bot (BotListenDiscord.py): Listens to Discord messages, enqueues them, and sends data to a local webhook for further processing.
  • Queue Dispatcher (QueueDispatcher.py): Manages a message queue, dispatches save/query commands to webhooks, and integrates with the Discord bot.
  • ChromaDB Integration (ChromaDBSaver.py, UnusedSaver.py, AlternateSaverFinished.py, FastAPIChromaSaver.py): Handles embedding generation (via Ollama or HuggingFace), persistent storage, retrieval, and reset operations using ChromaDB.
  • FastAPI Services: Expose REST endpoints for saving, viewing, querying, and resetting stored messages and embeddings.
  • Ollama: Provides local LLM and embedding model inference (e.g., for generating embeddings or answers).
  • n8n: Orchestrates webhooks and automates message flow between Discord, FastAPI, and Ollama.

Workflow Overview

  1. Discord messages are captured and sent to a webhook (via n8n).
  2. Messages are embedded (using Ollama or HuggingFace models) and stored in ChromaDB.
  3. FastAPI endpoints allow saving new data, querying for relevant context, and generating LLM-based answers.
  4. Responses can be sent back to Discord via n8n.

Requirements

  • Python 3.8+
  • Docker (for Ollama)
  • n8n (for workflow automation)
  • ChromaDB, FastAPI, Discord.py, requests, sentence-transformers, transformers, etc.

Usage

  1. Start Ollama (Docker) and n8n.
  2. Run the FastAPI and Discord bot scripts as needed.
  3. Configure webhooks and endpoints in n8n to connect all services.
  4. Interact with the Discord bot; messages will be processed, stored, and can be queried with LLM-powered responses.

This project is intended for research and experimentation with RAG pipelines and LLM integration in real-time chat environments.

About

This project is a modular pipeline for retrieval-augmented generation (RAG) using Discord, FastAPI, ChromaDB, Ollama, and n8n. It enables capturing Discord messages, embedding and storing them in a vector database, and generating context-aware responses using LLMs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages