Team Ai
Apppublic

mustafac0des/Multi-Document-RAG-Agent

sourceHugging Faceapache-2.0updated 22d agoView on Hugging Face
0likes
App README

๐Ÿ‘ฅ Role-Based Access Control RAG Agent

A powerful and secure AI chatbot that allows employees to query internal company documents with strict role-based access control.

โœจ Features

  • โ€”๐Ÿ” Role-Based Access Control (RBAC) - Users only see information they are authorized to access based on their simulated role
  • โ€”๐Ÿ“š Multi-Document Ingestion - Processes Markdown files and extracts valuable metadata for precise querying
  • โ€”๐Ÿง  Local LLM & Embeddings - Fully local generation and embeddings using open-source HuggingFace models for data privacy
  • โ€”๐Ÿ—ƒ๏ธ Vector Database - Utilizes ChromaDB for fast, efficient, and persistent document retrieval
  • โ€”๐Ÿ’ฌ Gradio Interface - An easy-to-use, interactive web UI for chatting with the AI

๐Ÿš€ Getting Started

Installation

  1. 1.Clone the repository
  2. 2.Install the required dependencies: pip install gradio transformers sentence-transformers langchain-core langchain-chroma pyyaml python-dotenv torch
  3. 3.Create or configure your .env file in the root directory

Running the App

  1. 1.Open your terminal in the project folder
  2. 2.Run the application: python app.py
  3. 3.Access the web interface via the local URL provided (usually http://127.0.0.1:7860)

๐ŸŽฏ Quick Tips

  • โ€”Use the role dropdown to test how different roles (e.g., HR, Executive, Engineer) affect the AI's responses
  • โ€”Ensure your Markdown documents in the company_documents folder have correct YAML frontmatter for roles
  • โ€”Ask specific, detailed questions for the best response from the LLM
  • โ€”If the AI says "I cannot help you with that!", try changing your simulated role to one with higher clearance

โ“ Questions?

  • โ€”Can I add new documents? - Yes, place new Markdown files in the company_documents folder and restart the app
  • โ€”How do I change roles? - Select a different role from the dropdown menu in the Gradio UI
  • โ€”Is my data sent to the cloud? - No, the app uses local embeddings and a local LLM (google/flan-t5-base) to keep data secure
  • โ€”Why is the AI not answering my question? - You either lack the required role to view the source document, or the answer isn't in the knowledge base

๐Ÿ› ๏ธ Tech Stack

  • โ€”UI Framework: Gradio
  • โ€”Vector Store: ChromaDB
  • โ€”Embeddings: SentenceTransformers (all-MiniLM-L6-v2)
  • โ€”LLM: HuggingFace Transformers (google/flan-t5-base)
  • โ€”Orchestration: Langchain Core