CoolFace
Apppublic

Khatwanigaurav/Doc_QA_Agent

sourceHugging Facemitupdated 4mo agoView on Hugging Face
0likes
App README

PolicyQA — Document QA Agent

Upload a policy document or report (PDF or plain text). Ask questions in natural language. Get answers cited to exact sections.

Pipeline

Upload PDF / paste text
        │
        ▼
pymupdf extracts text
        │
        ▼
Section-aware parser (detects headings → builds §path per section)
        │
        ▼
Chunk each section (600 chars / 100 overlap, heading prepended)
        │
        ├── BGE-base-en-v1.5 → FAISS   (dense,  top-20)
        ├── BM25Okapi                   (sparse, top-20)
        └── RRF fusion k=60            (merged, top-20)
                    │
                    ▼
          BGE-reranker-large            (cross-encoder, top-5)
                    │
                    ▼
          flan-t5-xl  (generator, ~3B)
                    │
                    ▼
          flan-ul2    (judge,    ~20B)  score 1–10
                    │
          score < 6 → escalate
          score ≥ 6 → cited answer