DocuChat_AI is a production-style AI document intelligence assistant that turns documents into searchable knowledge, source-cited answers, extracted entities, risk signals, document classifications, and measurable RAG evaluation results.
Launch the hosted application:
DocuChat_AI is built for analysts, students, recruiters, founders, researchers, and teams who need to understand long documents quickly while keeping answers grounded in source evidence.
Most document chatbots stop at upload and Q&A. DocuChat_AI goes further by adding a full AI intelligence layer:
- RAG chat with source-cited answers
- OCR support for scanned PDFs using
pytesseractandpypdfium2 - Document classification into useful business/research categories
- NER entity extraction for people, organizations, dates, money, and locations
- Risk detection for legal risks, missing information, deadlines, and action items
- Evaluation dashboard for labeled test questions and measurable RAG quality
- Optional authentication using
APP_PASSWORD - Privacy-first design with no default MongoDB/PostgreSQL user logging
Add your screenshots inside the assets/ folder using these exact filenames.
| Feature | What It Does |
|---|---|
| Document Upload | Upload PDF, DOCX, TXT, and text-based or scanned PDF files |
| OCR for Scanned PDFs | Uses pypdfium2 + pytesseract + Pillow; Docker mode installs Tesseract OCR |
| RAG Q&A | Ask natural-language questions over uploaded documents |
| Source Citations | Shows retrieved chunks, file names, pages, and preview snippets |
| Document Classification | Classifies files as Research Paper, Contract, CV, Invoice, Policy, Report, or Other |
| NER Entity Extraction | Extracts People, Organizations, Dates, Money, and Locations |
| Risk Detection | Detects Legal risks, Missing information, Deadlines, and Action items |
| RAG Quality Metrics | Shows retrieved chunks, confidence score, citation coverage, and context utilization |
| Evaluation Dashboard | Upload labeled CSV test questions and score answer correctness and faithfulness |
| Workflow Tabs | Chat, Summaries, Extract, Analyze, Intelligence, Evaluation, and Deliverables |
| Optional Auth | Add APP_PASSWORD to protect the app; omit it for public demo mode |
| Privacy First | No default database logging of user documents, prompts, or chat history |
The Intelligence tab transforms the app from a simple RAG chatbot into a document analysis workspace.
The app classifies uploaded documents into:
Research Paper / Contract / CV / Invoice / Policy / Report / Other
The current version uses LLM-based classification, which is lightweight and CPU-friendly for Hugging Face Spaces.
Future enhancement:
If deployed on Hugging Face GPU, this can be upgraded to a fine-tuned BERT / RoBERTa classifier for faster and more consistent document-type prediction.
The app extracts high-value entities:
People
Organizations
Dates
Money
Locations
The app surfaces practical document risks:
Legal risks
Missing information
Deadlines
Action items
Every answer can display:
Retrieved chunks
Confidence score
Citation coverage
Context utilization
These metrics help users and recruiters see that the app is not just generating answers, but exposing retrieval behavior.
DocuChat_AI includes a labeled evaluation workflow for testing RAG quality.
Upload an evaluation CSV:
question,expected_answer,expected_source
What is the contract deadline?,The deadline is 15 June 2026.,contract.pdf page 3
Who is the policy owner?,The policy owner is the HR department.,policy.pdfThen run the evaluation suite to measure:
| Metric | Meaning |
|---|---|
| Retrieval Precision@K | Whether relevant chunks are retrieved in the top results |
| Answer Faithfulness | Whether the answer is supported by retrieved context |
| Answer Correctness | Whether the answer matches the expected answer |
| Citation Accuracy | Whether the answer is backed by visible source citations |
| Confidence Score | Lightweight score combining retrieval/citation signals |
Included file:
eval_sample.csv
- Secure Access - Optional
APP_PASSWORDprotects private demos. - Document Intake - Users upload PDF, DOCX, TXT, or scanned PDFs.
- Text Extraction + OCR - Text loaders handle normal files; OCR handles scanned PDFs in Docker mode.
- Chunking - Documents are split into token-aware chunks with overlap.
- Embeddings - Hugging Face sentence-transformer embeddings convert chunks into vectors.
- FAISS Vector Store - Chunks are indexed for semantic search.
- Retriever - History-aware retriever finds relevant context for each question.
- Groq LLM - The model answers using only retrieved document context.
- Citations + Metrics - Answers show source citations and RAG quality signals.
- Intelligence + Evaluation - Classification, NER, risk detection, and labeled evaluation run on top of the document knowledge base.
| Layer | Tools |
|---|---|
| UI | Streamlit |
| RAG Framework | LangChain |
| LLM Provider | Groq |
| Embeddings | Hugging Face Sentence Transformers |
| Vector Store | FAISS |
| OCR | pypdfium2, pytesseract, Pillow, Tesseract OCR |
| Document Loaders | PyPDF, DOCX2TXT, LangChain loaders |
| Evaluation | Labeled CSV + LLM-as-judge scoring |
| Deployment | Hugging Face Spaces, Docker |
| Language | Python |
DocuChat_AI is intentionally privacy-first.
- Uploaded files are processed through temporary files.
- The FAISS index and chat history live in the active Streamlit session.
- The app does not log user documents, prompts, chat history, retrieved chunks, or feedback to MongoDB/PostgreSQL by default.
- MongoDB/PostgreSQL can be added later for user history, feedback, and analytics, but only with clear consent and security controls.
- API keys should be stored in Hugging Face Secrets or environment variables.
You can protect the app with a simple environment secret:
APP_PASSWORD=your_private_password
Behavior:
If APP_PASSWORD is set -> app becomes password-protected
If APP_PASSWORD is not set -> app runs in public demo mode
OCR for scanned PDFs requires both Python packages and the Tesseract system binary.
Python dependencies:
pypdfium2
pytesseract
Pillow
System dependency:
tesseract-ocr
For reliable OCR on Hugging Face:
Use Docker SDK
The included Dockerfile installs:
tesseract-ocr
poppler-utils
DocuChat_AI/
│
├── app.py # Main Streamlit app
├── README.md # GitHub documentation
├── DEPLOYMENT.md # Deployment, OCR, auth, and eval guide
├── requirements.txt # Python dependencies
├── runtime.txt # Python runtime
├── Dockerfile # Docker deployment with OCR system packages
├── eval_sample.csv # Sample labeled evaluation file
├── LICENSE # MIT License
├── .gitignore
├── .gitattributes
│
└── assets/
├── complete_architecture.svg
├── app_home.png
├── document_processing.png
├── chat_with_sources.png
├── intelligence_tab.png
└── evaluation_dashboard.png
git clone https://github.com/dineshbarri/DocuChat_AI.git
cd DocuChat_AI
python -m venv .venvActivate the environment:
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activateInstall dependencies:
pip install -r requirements.txtCreate .env:
GROQ_API_KEY=your_groq_api_key_here
APP_PASSWORD=optional_demo_passwordRun:
streamlit run app.pyStandard text-based document mode:
SDK: Streamlit
Hardware: CPU Basic or higher
OCR scanned PDF mode:
SDK: Docker
Hardware: CPU Upgrade recommended
Required secret:
GROQ_API_KEY=your_groq_key_here
Optional secret:
APP_PASSWORD=your_private_demo_password
Full deployment instructions are available in:
DEPLOYMENT.md
Summarize this document in 6 crisp bullet points.
What are the legal risks, missing information, and deadlines?
Extract all people, organizations, dates, money values, and locations.
Classify this document and explain why it belongs to that category.
Create an action-item checklist from this document.
Generate a presentation outline from this document.
- Fine-tuned BERT / RoBERTa document classifier for GPU deployments
- Persistent user workspaces with opt-in database storage
- MongoDB/PostgreSQL logging for metadata, feedback, and analytics with explicit user consent
- Qdrant or ChromaDB persistent vector storage
- User accounts and private document libraries
- Reranking for higher retrieval precision
- Page-level highlighted citations
- Multi-document comparison mode
- CSV, Excel, PPTX, and web URL ingestion
If this project is useful, consider starring the repository. It helps more developers, recruiters, and AI builders discover the project.




