A Retrieval-Augmented Generation (RAG) console app built with LlamaIndex and OpenAI.
LlamaIndex/
├── .venv/ ← managed by uv (Python 3.10)
├── data/
│ └── sample.txt ← drop your documents here (.txt, .pdf, .docx, …)
├── .env.example ← copy to .env and add your OpenAI key
├── main.py ← the RAG console app
└── pyproject.toml
- First run — reads all files in
data/, chunks + embeds them (OpenAItext-embedding-3-small), stores the index in.index_store/ - Subsequent runs — loads the persisted index (no re-embedding cost)
- Chat loop — uses
condense_plus_contextmode: condenses follow-up questions into standalone queries, retrieves top-3 chunks, passes context togpt-4o-mini
# 1. Add your OpenAI key
cp .env.example .env # then edit .env
# 2. Add your own docs to data/ (optional — sample.txt is included)
# 3. Run
.venv/Scripts/python main.py| Input | Action |
|---|---|
| any text | Ask a question |
clear |
Reset conversation history |
quit / exit |
Exit the app |
To add more documents, drop files into
data/and delete.index_store/to trigger a re-index.