This project implements a simple Retrieval-Augmented Generation (RAG) system that lets you query your personal notes using OpenAI GPT models.
It retrieves the most relevant text chunks from your local notes and uses GPT to generate context-aware answers.
- Local note retrieval: Searches your .txt notes using sentence embeddings.
- Context-aware GPT answers: Combines retrieved chunks with GPT reasoning.
- Simple CLI interface: Type questions directly in the terminal.
- Lightweight & extensible: Built with standard Python libraries and sentence-transformers.
- Chunking: Text files are split into small overlapping chunks.
- Embedding: Each chunk is converted to a numerical vector using a SentenceTransformer model (all-MiniLM-L6-v2).
- Retrieval: When you ask a question, the system finds the most similar chunks via cosine similarity.
- Generation: The top chunks are passed to an OpenAI GPT model (gpt-4o) to generate a contextually relevant answer.
Clone the repository
git clone https://github.com/csmansour/rag-notes.git
cd rag-notes
Install dependencies
pip install -r requirements.txt
Add your OpenAI API key by copying the example environment file and filling in your key:
cp .env.example .env
Run the assistant interactively:
python main.py
Then simply type a question, for example:
Ask GPT: How can I reduce stress in daily life?Sample output:
Meditation helps reduce stress and improve focus. Start with short daily sessions focusing on your breath.
Type exit or quit to end the session.
- Add persistent vector storage (e.g., FAISS, Chroma, or Qdrant).
- Support more file types such as PDF, Markdown, and DOCX.
- Implement a web-based interface for querying notes.
- Add caching to speed up repeated queries.
- Enable configurable embedding and GPT models via
.envsettings.