This is a small conversational RAG app for asking questions over text documents. I use it for my markdown notes, but it should work with any text-based documents. PDF support is in the works.
The current flow is:
- Sync markdown notes from
ditek/Notesor use local files innotes/. - Split notes into chunks with LangChain's text splitter.
- Embed chunks with Hugging Face.
- Store vectors in Chroma.
- Retrieve relevant chunks for each question.
- Rewrite follow-up questions using chat history.
- Answer with a Hugging Face chat model.
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .envEdit .env and set a Hugging Face token with at least this permission:
Make calls to Inference Providers
Download notes a public git repo (specified in NOTES_REPO_CONTENTS_URL):
python main.py sync-notesDownload and rebuild the vector index:
python main.py sync-notes --indexYou can also index whatever markdown files are already in notes/:
python main.py index --resetpython main.py ask "What is an Ansible inventory?" --k 3streamlit run app.pyThe app includes:
- chat history
- query rewriting for follow-up questions
- source chunk display
- a
kslider for retrieved chunks - buttons to sync notes, rebuild the index, reload the index, and clear chat
- Set
HF_TOKENto allow communication with Hugging Face. OnlyMake calls to Inference Providerspermission is needed for that. - Set
CHROMA_DIR=./chroma_dbfor local development. - Keep
ENABLE_SIDEBAR_CONTROLS=falseto hide the sidebar in public embeds. - Set
DEFAULT_RETRIEVAL_Kto control how many chunks are retrieved when the sidebar is hidden.
Deployment-specific files live under deploy/.
For deploying to Hugging Face Spaces, see:
deploy/huggingface/README.md