Standalone local RAG (retrieval augmented generation) agent for querying a directory of Markdown/MDX docs with Ollama.
Prereqs
- Ollama running locally
- An embedding model (default:
nomic-embed-text) - A chat model (default:
minimax-m2.5:cloud)
Setup
Quick setup:
cd ~/Projects/docs-rag
./scripts/run.sh setupManual setup:
cd ~/Projects/docs-rag
python3 -m venv .venv
source .venv/bin/activate
pip install -r agent/requirements.txtPull models:
ollama pull nomic-embed-text
ollama pull minimax-m2.5:cloudBuild an index for a docs folder
You can index any folder of .md/.mdx.
cd ~/Projects/docs-rag
./scripts/run.sh index --docs /absolute/path/to/your/docs --name mydocsBy default the index is stored under:
~/.cache/docs-rag/indexes/<name>Override via--index ...orDOCS_RAG_INDEX=....
Run the agent server
cd ~/Projects/docs-rag
./scripts/run.sh serve --name mydocs --port 8787All-in-one (index + serve):
cd ~/Projects/docs-rag
./scripts/run.sh up --docs /absolute/path/to/your/docs --name mydocsEndpoints:
GET /healthPOST /api/ask{ "question": "...", "k": 10, "k_per_query": 8 }
Reusing the React sidebar components
This repo also includes:
web/DocsChat.tsxweb/DocRightSidebar.tsxThey’re plain TSX components you can import into a Vite/React app (you’ll likely need a Vite alias andserver.fs.allowif importing from outside the app’s root).