# Trust-First AI Copilot **Perplexity-Style • System-Driven • No Custom LLM** Deployed Link: https://trust-first-ai.vercel.app/ A trust-first AI Copilot that delivers **verified, source-grounded, and confidence-scored answers** using strict system rules — inspired by Perplexity and designed to fix the core limitations of modern AI copilots. --- ## Problem Most AI copilots today: - Produce confident but incorrect (hallucinated) answers - Lose context in long or multi-file documents - Hide sources and assumptions - Provide limited admin visibility and control - Encourage blind dependency on AI outputs These issues lead to **wrong decisions, rework, and low trust**. --- ## Solution This project implements a **system-first AI Copilot** where: - Retrieval is mandatory (no context → no answer) - Every answer is backed by sources - Confidence is explicitly shown - Low-confidence answers are refused - Automation is human-approved - Security, transparency, and auditability are built-in The focus is **system design over model size**. --- ## Core Principles - No guessing - No hidden sources - No blind automation - Refusal is a feature, not a failure --- ## Key Features - Mandatory Retrieval-Augmented Generation (RAG) - Source-linked answers with citations - Confidence scoring (High / Medium / Low) - Automatic refusal on insufficient data - Workspace / project-level context memory - Intent detection and auto-clarification - Human-in-the-loop automation (n8n) - Zero-trust data access - Full audit logs (OpenTelemetry) - Model-agnostic LLM layer (Groq) --- ## System Architecture User → Intent Detection → Search & Retrieval (Tavily + Vector DB) → Context Ranking & Filtering → LLM (Groq – language & reasoning only) → Verification & Confidence Engine → Answer + Sources + Assumptions → (Optional) Human-Approved Automation → Audit Logs & Admin Dashboard ## What This Project Is Not - Not a chatbot - Not prompt-dependent - Not blind AI - Not a Copilot replacement This is a **controlled, transparent, enterprise-ready AI system**. --- ## Tech Stack **Frontend** - Next.js - React - Tailwind CSS **Backend** - FastAPI (Python) **AI & Data** - LLM: Groq (LLaMA / Mixtral) - Search: Tavily API - Embeddings: Hugging Face / Local models - Vector DB: FAISS / Qdrant - Automation: n8n - Logging & Audit: OpenTelemetry **Deployment** - Frontend: Vercel - Backend: Render --- ## Project Structure project-root/ ├── frontend/ │ ├── pages/ │ ├── components/ │ └── services/ ├── backend/ │ ├── main.py │ ├── rag/ │ ├── verification/ │ ├── automation/ │ └── requirements.txt ├── docs/ └── README.md yaml Copy code --- ## Required API Keys | Service | Purpose | |-------|---------| | Groq | LLM inference | | Tavily | Web search | | Hugging Face | Embeddings | | n8n | Automation | > All API keys are stored **only in backend environment variables**. --- ## Local Setup (Backend) ```bash git clone https://github.com/your-username/your-repo.git cd backend python -m venv venv source venv/bin/activate pip install -r requirements.txt Create .env: env Copy code GROQ_API_KEY=xxxx TAVILY_API_KEY=tvly_xxxx HF_API_KEY=hf_xxxx N8N_API_KEY=xxxx N8N_BASE_URL=http://localhost:5678 Run backend: bash Copy code uvicorn main:app --reload Local Setup (Frontend) bash Copy code cd frontend npm install npm run dev Deployment Backend Push code to GitHub Connect repository to Render Build command: bash Copy code pip install -r requirements.txt Start command: bash Copy code uvicorn main:app --host 0.0.0.0 --port 10000 Frontend Deploy via Vercel Set backend API URL in environment variables Security & Trust Model API keys never exposed to frontend Per-user data isolation Role-based access control Full audit trail for AI actions How Hallucinations Are Prevented Retrieval is mandatory Claims must map to sources Confidence is evaluated Low confidence triggers refusal No source → No answer Use Cases Research and academic assistance Enterprise internal knowledge copilots Policy and compliance analysis Long-document summarization Decision-support systems Future Improvements Offline read-only mode Multimodal reasoning (charts + text) Advanced admin dashboards Domain-specific copilots Final Note LLMs don’t fail — systems fail. This project demonstrates how strong system design beats larger models.