Spaces:
Running
Running
| title: Document AI Analyst | |
| emoji: π§ | |
| colorFrom: indigo | |
| colorTo: purple | |
| sdk: docker | |
| app_port: 7860 | |
| pinned: true | |
| license: mit | |
| short_description: Enterprise Agentic RAG β upload PDFs and chat with AI | |
| # π§ Document AI Analyst β Enterprise Agentic RAG System | |
| Upload complex PDFs, financial reports, legal contracts, or research papers and chat with an AI agent that provides **accurate, cited insights** powered by Retrieval-Augmented Generation. | |
| ## β¨ Features | |
| - **Multi-Format Upload** β PDF, DOCX, TXT, Markdown with smart chunking | |
| - **Semantic Search** β Two-stage retrieval with cross-encoder reranking | |
| - **Streaming Chat** β Real-time AI responses with inline source citations | |
| - **Data Isolation** β Per-user vector collections for complete privacy | |
| - **Open-Source LLMs** β Powered by Mistral-7B and HuggingFace ecosystem | |
| ## ποΈ Architecture | |
| | Layer | Technology | | |
| |---|---| | |
| | **Frontend** | Next.js 16, Tailwind CSS v4, Shadcn UI v2 | | |
| | **Backend** | FastAPI, SQLAlchemy, JWT Auth | | |
| | **Embeddings** | sentence-transformers/all-MiniLM-L6-v2 (local) | | |
| | **Vector Store** | ChromaDB (persistent, per-user collections) | | |
| | **Reranker** | cross-encoder/ms-marco-MiniLM-L-6-v2 | | |
| | **LLM** | Mistral-7B-Instruct via HuggingFace Inference API | | |
| | **Deployment** | Docker multi-stage build on HuggingFace Spaces | | |
| ## π Quick Start | |
| 1. **Register** an account | |
| 2. **Upload** a PDF document | |
| 3. **Wait** for processing (chunking + embedding) | |
| 4. **Ask** questions and get cited answers! | |
| ## π§ Local Development | |
| ```bash | |
| # Backend | |
| cd backend && python3 -m venv .venv && source .venv/bin/activate | |
| pip install -r requirements.txt | |
| uvicorn app.main:app --port 7860 | |
| # Frontend | |
| cd frontend && npm install && npm run dev | |
| ``` | |
| ## π¦ Environment Variables | |
| | Variable | Required | Description | | |
| |---|---|---| | |
| | `HF_TOKEN` | β | HuggingFace API token for LLM inference | | |
| | `SECRET_KEY` | β | JWT signing secret | | |
| | `DATABASE_URL` | β | SQLite path (default: `sqlite:///./data/app.db`) | | |
| ## π οΈ Tech Stack | |
| Built with: **FastAPI** β’ **LangChain** β’ **ChromaDB** β’ **HuggingFace** β’ **Next.js 16** β’ **Tailwind CSS** β’ **Shadcn UI** |