Skip to content
All projects

Generative AI

Klaro.

RAG document assistant: summarize any PDF or scan, then chat with it and get cited answers

View project

Overview

Klaro summarizes PDFs, scanned images and text files, then lets you ask questions about them and get answers that cite the exact passages they came from.

What I built

  • Text extraction with pdf-parse for PDFs and Tesseract.js OCR for scans, feeding two pipelines that run in parallel: indexing and summarization.
  • RAG indexing: overlapping 1,500-character chunks embedded with gemini-embedding-001 and stored in Pinecone, one namespace per document.
  • Whole-document summaries: a single long-context Gemini call, or map-reduce over sections for very large files, constrained to structured JSON output.
  • Chat answers streamed token by token over Server-Sent Events, grounded only in retrieved passages, with clickable [n] citations.
  • A fallback at every step: ordered Gemini model fallback, 429 retry handling, and a clearly labelled extractive summary when the AI is unavailable.
  • A routes, controllers and services backend with helmet, a CORS allow-list, rate limiting and in-memory uploads, covered by a node --test suite.

Outcome

Summaries cover the whole document, not just the first pages, and every chat answer can be checked against its source. When a service fails, users still get a result.

Stack

React 19, Vite, Node.js, Express, Gemini, Pinecone, Tesseract.js, pdf-parse