FurqanAli12345's picture
Deploy static Space
475fa4f verified
|
Raw History Blame Contribute Delete
2.18 kB
metadata
title: RAG Document Assistant
emoji: πŸ“„
colorFrom: green
colorTo: blue
sdk: static
app_file: index.html
pinned: false
license: mit
short_description: Grounded, cited answers from your own documents.
tags:
  - rag
  - retrieval
  - embeddings
  - question-answering

RAG Document Assistant

Ask questions about your own documents β€” answers are grounded in your text, cited to the source, and the assistant says "I don't know" instead of guessing. Runs entirely in your browser.

What it does

  1. Upload .txt / .md files (or Load sample docs β€” a fictional company handbook).
  2. Build the index.
  3. Ask a question β†’ get an answer, the retrieval mode, and the exact source chunks it came from.

Try: "What is the refund window?", "How do I reset my password?", "What are the support hours?"

How the RAG pipeline works

  • Chunking β€” overlapping, sentence-aware windows so context isn't cut at boundaries.
  • Embeddings β€” a TF-IDF vectoriser computed in-browser (transparent and instant).
  • Retrieval β€” cosine similarity over chunk vectors returns the top matches.
  • Grounding β€” answers are assembled only from retrieved chunks and cited; below a similarity threshold it returns an explicit "I don't know".

About this demo

This live Space is the extractive, in-browser version (free to host as a Hugging Face Static Space, no key, no server). The full Python project adds neural sentence-transformers embeddings and optional grounded LLM generation (Gemini/OpenAI) with a graceful key-free fallback:

πŸ”— Source: https://github.com/furqunali/rag-document-assistant

Sample docs are fictional. Uploaded files are processed in-memory and never leave your device.

Files

  • index.html β€” UI
  • logic.js β€” chunk β†’ TF-IDF embed β†’ cosine retrieve β†’ grounded answer (also runnable under Node)

Limitations

  • Extractive mode returns the most relevant passage; the full version adds synthesised generative answers.
  • TF-IDF is keyword-semantic; the Python version's neural embeddings capture meaning more deeply.
  • Designed for demo-sized document sets held in memory.

License

MIT.