An end-to-end Retrieval-Augmented Generation (RAG) application that allows users to upload PDF documents and ask natural language questions about their contents.
The application processes documents using semantic search, retrieves the most relevant context, and generates accurate answers using Google's Gemini model.
- 📄 Upload and index PDF documents
- ✂️ Automatic document chunking
- 🧠 Semantic embeddings using Sentence Transformers
- 🗂️ Vector search powered by ChromaDB
- 🤖 AI-powered answers using Google Gemini
- 📚 Source attribution for every answer
- 🔄 Replace previously indexed document
- 🧪 Comprehensive unit test suite
- 🎨 Clean Streamlit interface
Upload any PDF and index it into the vector database.
Ask questions in natural language.
Example:
What is Gradient Descent?
Every answer includes the document chunks used to generate the response.
Streamlit UI
│
▼
RAG Service Layer
│
┌─────────────────┴─────────────────┐
▼ ▼
Retrieval LLM Generation
│ │
▼ ▼
ChromaDB Gemini API
▲
│
Sentence Transformer Embeddings
▲
│
PDF Loader & Text Splitter
The project follows a layered architecture where the frontend only communicates with the service layer. Business logic is completely separated from the user interface.
- Streamlit
- Python 3.12
- Pydantic
- LangChain Text Splitters
- Sentence Transformers
- ChromaDB
- Google Gemini
- Pytest
app/
│
├── core/
│ └── config.py
│
├── llm/
│ └── gemini.py
│
├── models/
│ ├── answer_result.py
│ ├── chunk.py
│ ├── indexing_result.py
│ └── page.py
│
├── rag/
│ ├── loader.py
│ ├── splitter.py
│ ├── embeddings.py
│ ├── vector_store.py
│ └── prompt_builder.py
│
├── services/
│ └── rag_service.py
│
└── utils/
└── logger.py
tests/
data/
streamlit_app.py
Clone the repository
git clone https://github.com/nilaysarma/notes-assistant.git
cd notes-assistantInstall dependencies
uv syncCreate a .env file
GOOGLE_API_KEY=your_api_key_hereRun the application
uv run streamlit run streamlit_app.pyor
uv run streamlit run streamlit_app.py --server.fileWatcherType noneRun the complete test suite
uv run python -m pytest- Upload a PDF document.
- Extract text from each page.
- Split text into overlapping chunks.
- Generate embeddings for each chunk.
- Store embeddings in ChromaDB.
- Embed the user's question.
- Retrieve the most relevant chunks.
- Build a prompt using the retrieved context.
- Generate the final answer using Gemini.
- Display the answer together with its supporting sources.
- Chrome Extension for indexing web pages
- Multi-document support
- Embedding progress bar
This project is licensed under the MIT License.
