Skip to content

AyushAnand413/RagifyAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

41 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

title emoji sdk app_port
Corporate RAG Bot Backend
πŸ€–
docker
7860

πŸ€– Corporate-Bot β€” Enterprise RAG Assistant

Corporate-Bot is a production-grade, agentic Retrieval-Augmented Generation (RAG) assistant that enables users to upload corporate PDFs and interact with them using natural language.

It provides accurate, grounded answers and structured workplace actions powered by HuggingFace-hosted LLM inference.


🌐 Live Architecture

Frontend: Next.js (Vercel) Backend: Flask API (HuggingFace Spaces β€” Docker) LLM: HuggingFace Inference API (meta-llama/Llama-3.2-3B-Instruct:novita)


πŸš€ Core Capabilities

πŸ“„ Document Intelligence (RAG)

Upload any corporate PDF and:

  • Ask factual questions
  • Get grounded answers
  • Receive structured responses
  • Prevent hallucinations

Supports:

  • Text
  • Tables
  • Structured content

βš™οΈ Agent-Based Reasoning

The system intelligently detects user intent:

Example:

User Input

Create a ticket for VPN not working

Output

{
  "action": "create_ticket",
  "department": "IT",
  "priority": "High",
  "description": "VPN not working"
}

πŸ›‘οΈ Hallucination Control

Strict refusal logic:

If answer not present:

Information not found in uploaded document.

No guessing. No fabricated answers.


🧠 Architecture Overview

PDF Upload
   ↓
Unstructured Parser
   ↓
Structure-Aware Chunking
   ↓
Embedding (BGE)
   ↓
FAISS Vector Store
   ↓
Retriever
   ↓
Cross-Encoder Reranker
   ↓
Agent Supervisor
   ↓
HuggingFace LLM Inference
   ↓
Final Response

🧰 Technology Stack

Component Tool
Backend Flask
Frontend Next.js
Embeddings BAAI/bge-small-en
Vector DB FAISS
Reranker cross-encoder/ms-marco
LLM HuggingFace Inference
PDF Parser Unstructured
Hosting HuggingFace Spaces
Frontend Hosting Vercel

🌐 Live API Endpoints

Health Check

GET /

Response:

{
 "success": true
}

Upload PDF

POST /api/v1/upload

Ask Question

POST /api/v1/chat

🌍 Live Deployment

Backend:

https://AyushAnand413-corporate-rag-bot-backend.hf.space

Frontend:

(Your Vercel URL)

πŸ§ͺ Example Queries

Factual

What is the vision of 6G networks?


Table-based

What was revenue growth in FY25?


Conceptual

What are key risks mentioned?


Action

Create a ticket for VPN not working


πŸ” Security & Safety

βœ” No hallucinated data βœ” Evidence-based answers βœ” Strict refusal logic βœ” Secure inference via HF Token


πŸ§‘β€πŸ’» Local Development

Requirements

Python 3.10+


Install

pip install -r requirements.txt

Run

python web_app.py

Open:

http://localhost:7860

πŸ”‘ Environment Variables

Required:

HF_TOKEN=your_token

Optional:

HF_GENERATION_MODEL=meta-llama/Llama-3.2-3B-Instruct:novita
ALLOWED_ORIGINS=*

πŸ“ Project Structure

Corporate-bot/
β”‚
β”œ agent/
β”œ ingestion/
β”œ retrieval/
β”œ llm/
β”œ frontend/
β”œ web_app.py
β”œ Dockerfile
β”” requirements.txt

πŸ“ˆ Production Features

βœ” Docker deployment βœ” CI/CD via GitHub Actions βœ” HF Spaces hosting βœ” Vercel frontend βœ” Runtime PDF ingestion βœ” API-first backend


🎯 Use Cases

Enterprise assistants Corporate document search Legal document QA Financial report analysis Internal automation bots


🧠 Model Used

meta-llama/Llama-3.2-3B-Instruct:novita

Hosted via:

HuggingFace Inference API


πŸ‘¨β€πŸ’» Author

Ayush Kumar Anand Swarnim Vatsyayan


⭐ Conclusion

Corporate-Bot is a fully production-ready enterprise AI assistant combining:

  • Retrieval-Augmented Generation
  • Agent-based reasoning
  • Secure cloud inference
  • Modern frontend architecture

About

A RAG based chatbot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •