Skip to main content

Build-your-own Retrieval-Augmented Generation (RAG) system

Project description

brags

brags (Build-your-own RAG System) is a Python package that makes it easy to spin up a custom Retrieval-Augmented Generation (RAG) pipeline.
It combines Python for the RAG logic and a background Go file watcher that monitors your documents folder, so your vector database is always up to date.


Features

  • Config-driven RAG setup (rag_config.yaml)
  • Pluggable embeddings (HuggingFace, OpenAI, etc.)
  • Flexible LLM providers (OpenAI, Gemini, Ollama, HuggingFace)
  • Multiple vector stores (FAISS, Chroma, Qdrant, Pinecone, Weaviate)
  • Two file watcher modes:
  • Persistent (event-driven) → watches changes in real time via fsnotify
  • Cron (polling-based) → scans folder at regular intervals
  • Chunking and reranking options
  • Hallucination checking with embedding similarity or LLM-based fact checking
  • Configurable logging & monitoring

Installation

Clone the repo and install using Poetry or pip:

git clone https://github.com/omkar-wagholikar/brags.git
cd brags
pip install -e .

Build the Go watcher binary (required for background file monitoring):

cd go
./build.sh

This will generate the watcher binary that brags runs in the background.


Quick Start

  1. Copy the example config:
cp brags/rag_config.example.yaml brags/rag_config.yaml
  1. Edit rag_config.yaml with your model, embeddings, and file watcher preferences:
file_watcher:
  type: "persistent"   # Options: persistent, cron
  watch_dir: "./watched"
  pattern: "*.txt"
  cron_schedule: "*/3 * * * * *"  # Only for cron watcher
  debounce_seconds: 1             # Only for persistent watcher
  1. Run your RAG system:
python -m brags.main

The Go watcher will start in the background, monitor your documents folder, and update your vector DB whenever files change.


Project Structure

brags/                # Python package
go/                   # Go watchers + Python callback
tests/                # Unit tests
vector_db/            # Local FAISS indexes
rag_config.yaml       # Main configuration file

Configuration

All behavior is controlled via rag_config.yaml. Sections include:

  • llm → provider, model, API keys
  • embedding → embedding model & dimensions
  • vector_store → FAISS, Chroma, etc.
  • chunking → chunk size, overlap, splitter
  • reranking → reranker model
  • hallucination_checker → method + provider
  • logging → level and log file path
  • file_watcher → watcher type, path, debounce/cron config

See rag_config.example.yaml for details.


Testing

Run unit tests:

pytest tests

Contributing

We welcome contributions! Please see CONTRIBUTING.md for guidelines, and check CHANGELOG.md for updates.


License

This project is licensed under the MIT License.


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brags-0.0.5.tar.gz (1.8 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brags-0.0.5-py3-none-any.whl (1.8 MB view details)

Uploaded Python 3

File details

Details for the file brags-0.0.5.tar.gz.

File metadata

  • Download URL: brags-0.0.5.tar.gz
  • Upload date:
  • Size: 1.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for brags-0.0.5.tar.gz
Algorithm Hash digest
SHA256 52b1bf090be3c099f9247f74a0bde823aa01232e2b51f60594b2798f0f36bf32
MD5 8ef00b7e6fe7694785e70c7deec50ae9
BLAKE2b-256 15bede0c7e4bce5f77d80cfd1bdcf756c580d5c556d1a7a5fb6a531593b5b408

See more details on using hashes here.

File details

Details for the file brags-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: brags-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for brags-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8b2033654e5f22a114b35f325f64cefd52898265d6924b8793706a1620742a2f
MD5 6654af7afe4d4c4dfcea79b0ae79b9f0
BLAKE2b-256 5c5bc96878ed2ca9152b2ea38dfd98309a8e5a6d5f5cb9aeaf5e9d94edac561b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page