Advanced document Q&A with semantic search, reranking, and hybrid retrieval.
- Hybrid dense/sparse retrieval
- Semantic chunking
- Query expansion
- Reranking
- Document compression
- GPU/CPU support
-
Clone the repository
git clone https://github.com/feyzollahi/SimpleRAG.git cd SimpleRAG -
Install dependencies
poetry install
-
Configure environment variables
Create a
.envfile in the project root (see below for example).HF_TOKEN=your_huggingface_token MODEL_NAME=google/gemma-2b-it EMBEDDING_MODEL_NAME=BAAI/bge-small-en-v1.5 RERANKER_MODEL_NAME=BAAI/bge-reranker-base DOC_DIR=docs CACHE_DIR=.cacheHF_TOKENis required for some Hugging Face models. Get it from Hugging Face.- Adjust other variables as needed.
-
Add your documents
Place
.txt,.md, or.pdffiles in thedocsdirectory. -
Run the app
streamlit run app.py
HF_TOKEN=your_huggingface_token
MODEL_NAME=google/gemma-2b-it
EMBEDDING_MODEL_NAME=BAAI/bge-small-en-v1.5
RERANKER_MODEL_NAME=BAAI/bge-reranker-base
DOC_DIR=docs
CACHE_DIR=.cache
- Enter your question in the app UI.
- Adjust retrieval and generation settings in the sidebar.
- View sources and context for each answer.
- For best results, use high-quality documents.
- GPU is recommended for faster inference.
- All configuration is managed via
.env.
MIT