Punit1's picture
Add Hugging Face YAML header to README.md
39e07da
|
Raw
History Blame Contribute Delete
6.38 kB
metadata
title: Enterprise AI Copilot
emoji: πŸš€
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
pinned: false

πŸš€ Enterprise AI Copilot β€” A Multi-Agent Platform for Intelligent Enterprise Automation

Python 3.10 FastAPI React 18 LangGraph Qdrant Docker Pytest License

An enterprise-grade, multi-agent AI automation platform built with LangGraph, FastAPI, React 18, Qdrant Vector Database, and PostgreSQL. Features hybrid RAG search, natural language SQL generation, automated analytics, real-time web search, multi-tenant RBAC security, and a full ChatGPT-style streaming UI.


🌟 Key Architecture & Capabilities

πŸ€– 1. LangGraph Multi-Agent Suite

Powered by a Supervisor Planner Node that dynamically routes incoming queries to specialized agents:

  • πŸ“„ Retrieval Specialist (Hybrid RAG): Performs dense vector search in Qdrant with CrossEncoder reranking (ms-marco-MiniLM-L-6-v2).
  • πŸ—„οΈ SQL Intelligence Agent: Generates safe SQL queries validated by an AST parser that blocks destructive DML/DDL commands.
  • πŸ“Š Analytics Specialist: Generates structured metrics and dynamic chart visualizations (Recharts).
  • πŸ’» Code Specialist: Writes, explains, and debugs code snippets with markdown formatting.
  • 🌐 Web Search Specialist: Fetches real-time online data via DuckDuckGo integration.
  • πŸ’¬ Direct Response Synthesizer: Handles conversational queries and synthesizes grounded answers with page-level citations.

πŸ’¬ 2. ChatGPT-Style Frontend Interface

  • Persistent Conversation Memory: Sessions and multi-turn chat history stored in PostgreSQL/SQLite.
  • Left Sidebar Navigation: Grouped conversation threads (Today, Yesterday, Previous) with instant session switching and deletion.
  • Live Response Streaming: Server-Sent Events (SSE) token streaming with word-by-word typing animation.
  • 1-Click Document Chat: Ask questions about any uploaded document directly from the Documents dashboard.

πŸ”’ 3. Enterprise Security & Multi-Tenant RBAC

  • Tenant Isolation: Every database record and vector payload is strictly tagged and filtered by tenant_id.
  • Role-Based Access Control:
    • πŸ‘‘ admin: Full platform control, user invitations, system audit logs, all document categories.
    • πŸ‘” hr: Access restricted to HR handbooks and policy documents.
    • πŸ’° finance: Access restricted to financial statements and sales metrics.
    • πŸ‘€ employee: General knowledge base search with upload restriction safeguards.

πŸ“Š 4. Observability & Monitoring

  • Structured Audit Traces: Every agent execution is logged in PostgreSQL with tokens used, routing decision, and latency in milliseconds.
  • Metrics Dashboard: Integrated Prometheus metrics exporter and Grafana dashboard monitoring container health and request volume.

πŸ“ Multi-Agent Flow Diagram

graph TD
    A[User Query] --> B[Supervisor Planner Node]
    B -->|routing == retrieval| C[RAG Retrieval Agent + Qdrant + Reranker]
    B -->|routing == sql| D[SQL Agent + AST Safety Validator]
    B -->|routing == analytics| E[Analytics Agent + Chart Generator]
    B -->|routing == code| F[Code Specialist Agent]
    B -->|routing == web| G[Web Search Agent + DuckDuckGo]
    B -->|routing == direct| H[Direct Conversational Handler]
    C --> I[Response Synthesizer Node]
    D --> I
    E --> I
    F --> I
    G --> I
    H --> I
    I --> J[Streaming SSE Output + Citation Metadata]

βš™οΈ Microservice Architecture

The platform runs 10 microservices orchestrated via Docker Compose:

Container Service Tech Stack Port
copilot_frontend Frontend UI React 18, TypeScript, TailwindCSS, Vite :3000
copilot_backend Core API & Agents FastAPI, LangGraph, SQLAlchemy, Uvicorn :8000
copilot_postgres Primary Database PostgreSQL 16 :5432
copilot_qdrant Vector Database Qdrant v1.12 :6333
copilot_redis Cache & Broker Redis 7 :6379
copilot_celery Task Worker Celery Background
copilot_nginx Reverse Proxy Nginx Alpine :8080
copilot_prometheus Metrics Collector Prometheus :9090
copilot_grafana Monitoring Dashboard Grafana :3001

⚑ Quick Start (Local Docker Setup)

1. Clone & Setup Environment

git clone https://github.com/purityadav2/Enterprise-AI-Copilot.git
cd Enterprise-AI-Copilot

# Copy sample environment configuration
cp .env.example .env

2. Launch All Microservices

docker compose -f docker/docker-compose.yml up -d

3. Open the App in Your Browser

4. Default Seed Credentials

  • Email: admin@company.com
  • Password: Admin@123!

πŸ§ͺ Running Automated Tests

Run the full pytest suite inside the backend container (24/24 unit & end-to-end tests passing):

docker compose -f docker/docker-compose.yml exec backend sh -c "cd /tests && pytest -v"

πŸš€ Free Deployment on Hugging Face Spaces

This project includes a single-container Dockerfile pre-configured for free deployment on Hugging Face Spaces:

  1. Create a Space on huggingface.co/new-space using Docker SDK (Blank).
  2. Add GROQ_API_KEY and SECRET_KEY in Space Settings βž” Secrets.
  3. Push to Hugging Face:
    git remote add hf https://huggingface.co/spaces/YOUR_USERNAME/Enterprise-AI-Copilot
    git push hf main --force
    

πŸ“œ License

Distributed under the MIT License. See LICENSE for more information.