← all work

PDF Question Answering with RAG

answers questions about an uploaded PDF from the passages it retrieves, not from memory.

  • LangChain
  • ChromaDB
  • MiniLM
  • Gemini
  • Flask
rag-pdf-summarizer / app.py
text_splitter = RecursiveCharacterTextSplitter(
    chunk_size=1000,
    chunk_overlap=200,
    length_function=len
)
results = vector_store.similarity_search(query, k=3)
why
long PDFs blow past context windows, and an LLM answering from memory drifts from the source. i wanted answers grounded in the actual pages.
how it works
the PDF is split into 1,000-character chunks with 200 overlap, embedded with MiniLM into a ChromaDB store per user session, and the 3 closest chunks go to Gemini 2.0 Flash, which answers from that context only.
what i learned
chunk size and overlap mattered more to answer quality than which LLM wrote the answer.
results
served through a Flask app with a separate vector store per session, PDF-only uploads and a 16 MB size limit.

chunk size and overlap are still the main levers being tuned.