A minimal Retrieval-Augmented Generation search tool. Point it at a folder of
.txt / .md / .pdf files and ask questions; answers are generated by an OpenAI
model using only your documents as context, with inline citations.
# 1. Install dependencies (a virtualenv is recommended)
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
# 2. Add your OpenAI API key
cp .env.example .env
# then edit .env and paste your key after OPENAI_API_KEY=Get a key at https://platform.openai.com/api-keys
# Drop your PDFs (or .txt/.md files) into the ./data folder, then build the index.
# You can pass a folder or a single file:
python main.py ingest data
python main.py ingest data/my-report.pdf
# Ask a one-off question
python main.py ask "How does RAGSearch work?"
# Or chat interactively
python main.py chat| Step | What happens |
|---|---|
ingest |
Files are chunked, each chunk is embedded with text-embedding-3-small, and vectors are saved to a local index.npz / index.json. |
ask |
Your question is embedded, compared to every chunk via cosine similarity, and the top matches are sent to gpt-4o-mini as grounding context. |
Set these in .env to override the defaults:
OPENAI_API_KEY— requiredEMBEDDING_MODEL— defaulttext-embedding-3-smallCHAT_MODEL— defaultgpt-4o-mini
Your .env and the generated index are git-ignored.