File size: 5,050 Bytes
ad27ec7
a864c4e
ad27ec7
e054490
bfa87c3
39c836f
f62cbf1
bfa87c3
e054490
bfa87c3
 
 
604aa46
bfa87c3
 
 
 
 
 
 
ad27ec7
e054490
f62cbf1
e054490
39c836f
190124a
 
 
bfa87c3
 
 
 
190124a
 
bfa87c3
 
 
 
190124a
 
bfa87c3
 
 
 
 
190124a
 
bfa87c3
bb9f87e
bfa87c3
 
39c836f
785b6bd
f62cbf1
bb9f87e
190124a
f62cbf1
e054490
bfa87c3
e054490
bfa87c3
 
 
 
e054490
bb9f87e
 
 
bfa87c3
 
 
 
190124a
bfa87c3
190124a
bfa87c3
 
 
 
 
 
 
 
190124a
bfa87c3
190124a
bb9f87e
 
 
190124a
 
 
a421bc4
f62cbf1
bfa87c3
190124a
bfa87c3
a421bc4
 
 
 
 
 
 
 
 
866f736
a421bc4
 
 
785b6bd
f62cbf1
 
bfa87c3
 
 
 
866f736
 
 
 
 
 
 
f62cbf1
39c836f
f62cbf1
39c836f
f62cbf1
39c836f
f62cbf1
bfa87c3
 
 
 
e054490
bfa87c3
e054490
bfa87c3
 
 
 
 
f62cbf1
 
a864c4e
e054490
a864c4e
e054490
bfa87c3
 
 
 
f62cbf1
 
 
bfa87c3
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# QA Enterprise RAG Platform

**Question your documents. Get cited answers in seconds. Secure, Scalable, Agentic Document Intelligence for the Modern Enterprise.**

[![Live Demo](https://img.shields.io/badge/🔴_LIVE-Try_Demo-blue?style=for-the-badge)](https://pkgprateek-ai-rag-document.hf.space/)
[![Deploy](https://github.com/pkgprateek/ai-rag-document/actions/workflows/deploy-to-hf.yml/badge.svg)](https://github.com/pkgprateek/ai-rag-document/actions/workflows/deploy-to-hf.yml)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![MIT License](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

<!-- Replace with actual screenshot: assets/demo-screenshot.png -->
<p align="center">
  <a href="https://pkgprateek-ai-rag-document.hf.space/">
    <img src="assets/demo-screenshot.jpeg" alt="Enterprise RAG Demo" width="700"/>
  </a>
</p>

---

## Why This Matters

Knowledge workers **spend 2.5 hours daily** searching for information buried in documents. Enterprise RAG eliminates that friction—upload your contracts, research papers, or financial reports, ask questions in plain English, and get precise answers with page citations in under 5 seconds.

---

## Architecture

```mermaid
flowchart TB
    subgraph Ingestion ["📥 Ingestion"]
        A["📄 PDF / DOCX / TXT"]
        B["✂️ RecursiveTextSplitter<br/>1000 chars · 200 overlap"]
        A --> B
    end
    
    subgraph Indexing ["📊 Indexing"]
        C["🧠 bge-small-en-v1.5<br/>384-dim embeddings"]
        D[("💾 ChromaDB<br/>Persistent")]
        B --> C --> D
    end
    
    subgraph Retrieval ["🔍 Retrieval"]
        E["💬 Question"]
        F["🎯 Top-4 Similarity"]
        E --> F
        D --> F
    end
    
    subgraph Generation ["✨ Generation"]
        G["🤖 Multi-Provider LLM<br/>GPT-OSS 120B (default)<br/>Llama 3.3 70B · Gemma 3 27B"]
        H["📝 Cited Answer"]
        F --> G --> H
    end
```

**Stack**: LangChain 1.0.7 · ChromaDB 1.3.4 · sentence-transformers · Groq + OpenRouter

---

## One-Minute Quickstart

```bash
# Clone and enter
git clone https://github.com/pkgprateek/rag-document-qa-workflow.git
cd rag-document-qa-workflow

# Set your API keys (both free)
echo "GROQ_API_KEY=your_key_here" > .env
echo "OPENROUTER_API_KEY=your_key_here" >> .env

# Run with Docker (recommended)
docker compose up
```

Open **http://localhost:7860** → Done.

<details>
<summary>Alternative: UV (10× faster than pip)</summary>

```bash
uv venv && source .venv/bin/activate
uv pip install -r requirements.txt
python app/main.py
```

</details>

🔑 **Get Your Free API Keys**  
- [Groq API key](https://console.groq.com/keys) (Required - GPT-OSS & Llama models)  
- [OpenRouter API key](https://openrouter.ai/keys) (Optional - Gemma model)

---

## Production Features Checklist

> 10 criteria for enterprise-grade RAG. Each is satisfied by this platform.

| Feature | Description |
|----------|----------|
| **Multi-format ingestion** | PDF, DOCX, TXT with intelligent parsing |
| **Semantic chunking** | 1000-char chunks, 200-char overlap |
| **Production embeddings** | bge-small-en-v1.5 (MTEB optimized) |
| **Persistent storage** | ChromaDB survives restarts |
| **Citation tracking** | Every answer links to source chunks |
| **Rate limiting** | 10 queries/hour (configurable) |
| **Privacy controls** | Auto-delete after 7 days |
| **Monitoring hooks** | Health checks, error logging |
| **Fast** | 50-200ms response time (p50) |
| **Portable** | Docker-ready, one-command deploy |

**[Design Decisions →](docs/DESIGN_DECISIONS.md)** — Deep dive into architectural choices.

---

## Performance

| Metric | Value |
|--------|-------|
| **End-to-end Latency (p95)** | 50-200ms |
| **Latency (p99)** | 200-400ms |
| **100-page contract** | 3-4s process, 150ms query |
| **Citation accuracy** | 93-96% relevance |
| **Throughput** | 1000+ requests/min |

*Powered by Groq's lightning-fast inference and optimized retrieval*

---

## Consulting & Pilots

**2-week paid pilots** for enterprise teams:

| Week | Deliverables |
|------|--------------|
| **Week 1** | Ingest your documents, tune chunking for your domain |
| **Week 2** | Deploy on your infrastructure, team training, ROI analysis |

**Includes**: Custom RAG system · Performance benchmarks · 30-day support

<p align="center">
  <a href="https://cal.com/your-link">
    <img src="https://img.shields.io/badge/📅_Book_Discovery_Call-blue?style=for-the-badge" alt="Book Call"/>
  </a>
</p>

---

## Contact

**Prateek Kumar Goel**

[![Live Demo](https://img.shields.io/badge/🚀_Demo-HuggingFace-yellow)](https://huggingface.co/spaces/pkgprateek/ai-rag-document)
[![GitHub](https://img.shields.io/badge/💻_Code-GitHub-black)](https://github.com/pkgprateek)
[![HuggingFace](https://img.shields.io/badge/🤗_Profile-HuggingFace-orange)](https://huggingface.co/pkgprateek)

---

<p align="center">
  <sub>
    MIT License · Built with production-grade MLOps practices
  </sub>
</p>