--- title: Full RAG Assistant emoji: ๐Ÿ’ป colorFrom: purple colorTo: gray sdk: gradio sdk_version: 6.0.1 app_file: app.py pinned: false --- ๐Ÿ“š RAG AI Assistant โ€” Document-Aware Chatbot Powered by Retrieval-Augmented Generation Welcome to the RAG AI Assistant, a lightweight, open-source document question-answering system that lets you chat with your own knowledge base. Upload documents โ†’ Rebuild the index โ†’ Ask questions โ†’ Get grounded, explainable answers sourced from your files. Built with: FAISS for fast vector search Sentence Transformers for embeddings Transformers QA pipeline for extraction Gradio Blocks UI for clean chat + KB management ๐Ÿš€ Features ๐Ÿง  Retrieval-Augmented Generation (RAG) The assistant retrieves relevant document chunks and uses a QA model to produce accurate, grounded answers. ๐Ÿ“‚ Knowledge Base Uploads You can upload your own documents directly inside the Space: Supported formats: txt, md, pdf, docx, doc โš™๏ธ Rebuildable FAISS Index After uploading files, click Rebuild index to update the vector store instantly โ€” no need to restart the Space. ๐Ÿ’ฌ Interactive Chat Ask free-form questions about your uploaded documents. The model will: Retrieve relevant context Extract answers Show confidence scores Cite the source document ๐Ÿ” Full Transparency If no answer is found, youโ€™ll receive helpful suggestions and context previews. ๐Ÿ› ๏ธ How It Works 1. Chunking Documents are split into overlapping chunks: Size: 500 characters Overlap: 50 characters 2. Embedding Each chunk is embedded with: sentence-transformers/all-MiniLM-L6-v2 3. Vector Search FAISS (IndexFlatIP) finds the closest matches using cosine similarity. 4. Answer Extraction A QA model extracts precise answers: deepset/roberta-base-squad2 ๐Ÿงช Usage Instructions 1. Upload Your Documents Go to the Knowledge Base tab and upload as many files as you want. 2. Rebuild the Index Click Rebuild index to process the files and generate embeddings. 3. Start Asking Questions Switch to the Chat tab and ask questions like: What is the main topic of the report? Summarize the key findings. What does section 3 say about metrics? ๐Ÿ“ Project Structure โ”œโ”€โ”€ app.py # Main application logic โ”œโ”€โ”€ config.yaml # Optional configuration file โ”œโ”€โ”€ knowledge_base/ # User-uploaded documents โ”œโ”€โ”€ index/ # Saved FAISS index + metadata โ””โ”€โ”€ README.md # This file ๐Ÿงฉ Tech Stack Python 3.10 Gradio FAISS Sentence Transformers Transformers (HuggingFace) PyPDF2 / python-docx ๐Ÿงฑ Roadmap (Upcoming Enhancements) ๐Ÿ”„ Streaming responses (LLM-style typing) ๐Ÿ“Š Document preview inside the chat ๐Ÿ“ Source highlighting of extracted spans ๐ŸŽจ Theming + cleaner chat UI โšก Optional lightweight QA model for faster inference Feel free to suggest improvements or contribute!