codexaitechnologies/Smartnotes
SmartNotes — Chat with Your Study Material
Workshop 3 Capstone Project · CodeXAI GenAI Workshop Series
SmartNotes is a local-first AI-powered document assistant. Upload any PDF, text file, or Markdown document and have a natural-language conversation with it. Everything runs on your machine — no API keys, no cloud, no data leaves your device.
What It Does
- Upload any PDF, TXT, or Markdown file
- Process — document is chunked, embedded (locally via
sentence-transformers), and stored in ChromaDB - Ask — type any question in plain English
- Answer — your local Ollama LLM answers using only the document content, and shows you the source chunks
Architecture
User uploads PDF/TXT
│
▼
load_and_chunk() ← LangChain loaders + RecursiveCharacterTextSplitter
│
▼
build_vectorstore() ← sentence-transformers (all-MiniLM-L6-v2) + ChromaDB
│
User asks a question
│
▼
retrieve() ← ChromaDB cosine similarity search
│
▼
generate_answer() ← Ollama LLM (llama3.2 by default)
│
▼
Answer + Source chunks shown in Streamlit UIPrerequisites
1. Install Ollama
Download from ollama.com and install for your OS.
# Pull the default model
ollama pull llama3.2
# Check it works
ollama run llama3.2 "Hello!"2. Python 3.10+
Verify with python --version.
Installation
# Clone / navigate to the project folder
cd workshop-3/smartnotes
# Create a virtual environment (recommended)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtRunning the App
# Make sure Ollama is running
ollama serve # or it may already be running as a background service
# Start SmartNotes
streamlit run app.pyOpen your browser at http://localhost:8501.
Usage
- Upload a PDF, TXT, or MD file using the sidebar
- Adjust chunk size, overlap, and k (chunks per answer) if desired
- Click 🚀 Process Document — wait a few seconds while the document is indexed
- Type a question in the chat input at the bottom
- Expand 📎 View source chunks below any answer to see exactly which parts of the document were used
Configuration
Using a Different Model
In the sidebar, change the model name to any model you have:
ollama pull mistral # fast, good for Q&A
ollama pull llama3.1:8b # larger, more accurate
ollama pull phi3:mini # very small, runs on 4GB RAMUsing OpenAI Instead
Change the OLLAMA_URL and OLLAMA_MODEL in rag_engine.py:
OLLAMA_URL = "https://api.openai.com/v1/chat/completions"
OLLAMA_MODEL = "gpt-4o-mini"Then add your API key to the requests header.
Project Structure
smartnotes/
├── app.py # Streamlit UI (upload, chat interface, source display)
├── rag_engine.py # RAG pipeline (load, chunk, embed, retrieve, generate)
├── requirements.txt # Python dependencies
└── README.md # This fileGenerated at runtime:
smartnotes/
└── smartnotes_db/ # ChromaDB persistent storage (auto-created)Concepts Used
This project applies everything from Workshop 3:
Troubleshooting
"Could not connect to Ollama" → Run ollama serve in a terminal and try again.
"Model not found" → Run ollama pull llama3.2 (or whatever model name you entered).
Slow on first run → The embedding model (all-MiniLM-L6-v2, ~90 MB) downloads on first use. Subsequent runs are fast.
PDF text garbled / empty → Some PDFs have scanned images rather than text. OCR is not supported in this version.
Built during CodeXAI Workshop 3 — AI for Document Intelligence
