--- title: RAG Document Q&A emoji: ๐Ÿ“š colorFrom: blue colorTo: indigo sdk: static pinned: true license: mit short_description: "In-browser RAG: ask questions about your own PDFs" tags: [rag, retrieval, question-answering, transformers.js, semantic-search] --- # ๐Ÿ“š RAG Document Q&A Retrieval-Augmented Generation pipeline that runs entirely in the browser: document loading (PDF via pdf.js, TXT, pasted text), chunking with overlap, sentence embeddings (Xenova/all-MiniLM-L6-v2), cosine-similarity vector search and extractive answering (Xenova/distilbert-base-cased-distilled-squad). Retrieved passages are shown with similarity scores so every answer is traceable. Documents never leave the user's device. Runs fully client-side with [Transformers.js](https://huggingface.co/docs/transformers.js) (ONNX Runtime Web) โ€” no server, no API keys. **Author:** [Alexandru Cojocari](https://www.linkedin.com/in/alexdataanalyst/) ยท [GitHub](https://github.com/DatadrivenAlex) โ€” Junior AI Developer (Generative AI, RAG, Agentic AI, Secure AI)