Skip to content

Latest commit

ย 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

QanoonAI

QanoonAI โš–๏ธ๐Ÿ‡ต๐Ÿ‡ฐ

QanoonAI Typing SVG

Production-Grade Agentic GraphRAG Platform for Pakistani Law

Python FastAPI Next.js LangGraph Docker License

An intelligent legal assistant that answers questions about Pakistani law โ€” Constitution 1973, Pakistan Penal Code, and Criminal Procedure Code โ€” using multi-agent reasoning, knowledge graphs, and hybrid retrieval with cross-encoder reranking.


โœจ Key Features

Feature Description
๐Ÿค– Agentic RAG Multi-agent LangGraph workflow with Planner โ†’ Router โ†’ Retriever โ†’ Generator โ†’ Verifier
๐Ÿ•ธ๏ธ Graph RAG Neo4j knowledge graph with cross-references, legal concepts, and hierarchy traversal
๐Ÿ” Hybrid Retrieval FAISS vector search + graph traversal + metadata filtering, fused with Reciprocal Rank Fusion (RRF)
๐ŸŽฏ Cross-Encoder Reranking ms-marco-MiniLM-L-12-v2 reranker for precision ranking
โšก Redis Caching LLM response cache, embedding cache, and retrieval cache with configurable TTLs
๐Ÿ“ฆ Large File Upload Chunked uploads (5 MB) handling files up to 4 TB without RAM overflow
๐Ÿ“Š Admin Dashboard Upload documents, manage ingestion, monitor system health at /admin
๐ŸŽค Voice Interface Speech-to-text (Groq Whisper) and browser-native TTS
๐Ÿณ Docker Ready Full docker-compose with 7 services โ€” one command deployment
๐ŸŒ™ Dark/Light Mode Modern chat UI with session history, PDF export, and copy buttons

๐Ÿ“ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        Next.js 14 Frontend                          โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚ Chat UI  โ”‚  โ”‚ File Uploaderโ”‚  โ”‚ Doc Mgr   โ”‚  โ”‚ System Panel โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
        โ”‚               โ”‚                โ”‚                โ”‚
โ”€โ”€โ”€โ”€โ”€โ”€โ”€ โ”‚ โ”€โ”€โ”€โ”€ FastAPI โ”€โ”€โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
        โ–ผ               โ–ผ                โ–ผ                โ–ผ
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚ /chat/*  โ”‚   โ”‚ /upload/*  โ”‚   โ”‚/documents โ”‚   โ”‚ /health  โ”‚
  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚                โ”‚
       โ–ผ                โ–ผ
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
  โ”‚  LangGraph   โ”‚  โ”‚ Celery Worker    โ”‚
  โ”‚  Agents      โ”‚  โ”‚ (Background)     โ”‚
  โ”‚              โ”‚  โ”‚                  โ”‚
  โ”‚  Planner     โ”‚  โ”‚  ZIP Extract     โ”‚
  โ”‚  Router      โ”‚  โ”‚  PDF Chunking    โ”‚
  โ”‚  Retriever   โ”‚  โ”‚  Embedding       โ”‚
  โ”‚  Generator   โ”‚  โ”‚  FAISS Indexing  โ”‚
  โ”‚  Verifier    โ”‚  โ”‚  Graph Building  โ”‚
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”
    โ–ผ         โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ FAISS  โ”‚ โ”‚  Neo4j   โ”‚ โ”‚ Redis โ”‚ โ”‚PostgreSQLโ”‚
โ”‚ Vectorsโ”‚ โ”‚  Graph   โ”‚ โ”‚ Cache โ”‚ โ”‚ Sessions โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Agent Workflow

graph LR
    A[Planner] --> B[Router]
    B --> C[Retriever]
    C --> D[Generator]
    D --> E{Verify?}
    E -->|Low Confidence| F[Verifier]
    F -->|Retry| C
    E -->|High Confidence| G[Formatter]
    G --> H[Response]
Loading

The Planner analyzes the query and selects a retrieval strategy:

  • vector_only โ€” simple factual questions
  • hybrid โ€” complex questions needing both vector + graph context
  • graph_heavy โ€” relationship/cross-reference queries

๐Ÿ—‚๏ธ Project Structure

QanoonAI/
โ”œโ”€โ”€ app.py                          # FastAPI application entry point
โ”œโ”€โ”€ docker-compose.yml              # 7-service orchestration
โ”œโ”€โ”€ Dockerfile                      # Backend multi-stage build
โ”œโ”€โ”€ Dockerfile.frontend             # Next.js multi-stage build
โ”œโ”€โ”€ requirements.txt                # Python dependencies
โ”œโ”€โ”€ .env.example                    # Environment variable template
โ”‚
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ config.py               # Central settings (Pydantic)
โ”‚   โ”‚   โ”œโ”€โ”€ dependencies.py         # Singleton dependency injection
โ”‚   โ”‚   โ”œโ”€โ”€ redis_client.py         # Redis client with connection pool
โ”‚   โ”‚   โ”œโ”€โ”€ celery_app.py           # Celery task queue configuration
โ”‚   โ”‚   โ””โ”€โ”€ logging.py              # Structured logging
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ agents/
โ”‚   โ”‚   โ”œโ”€โ”€ graph.py                # LangGraph multi-agent workflow
โ”‚   โ”‚   โ”œโ”€โ”€ prompts.py              # System prompts for all agents
โ”‚   โ”‚   โ””โ”€โ”€ tools.py                # Shared agent tools
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ embeddings/
โ”‚   โ”‚   โ”œโ”€โ”€ local_embedder.py       # sentence-transformers (all-mpnet-base-v2)
โ”‚   โ”‚   โ””โ”€โ”€ cache.py                # Redis-backed embedding cache
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ vectorstore/
โ”‚   โ”‚   โ””โ”€โ”€ faiss_store.py          # FAISS IndexFlatIP + metadata sidecar
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ graph/
โ”‚   โ”‚   โ”œโ”€โ”€ neo4j_client.py         # Neo4j driver singleton
โ”‚   โ”‚   โ”œโ”€โ”€ schema.py               # Graph schema (nodes, relationships)
โ”‚   โ”‚   โ”œโ”€โ”€ builder.py              # Knowledge graph builder
โ”‚   โ”‚   โ””โ”€โ”€ retriever.py            # Graph traversal retriever
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ ingestion/
โ”‚   โ”‚   โ”œโ”€โ”€ chunker.py              # Hierarchical legal chunker
โ”‚   โ”‚   โ”œโ”€โ”€ pipeline.py             # Ingestion orchestrator
โ”‚   โ”‚   โ””โ”€โ”€ tasks.py                # Celery ingestion tasks
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ retrieval/
โ”‚   โ”‚   โ”œโ”€โ”€ hybrid_retriever.py     # FAISS + Graph + Metadata + RRF
โ”‚   โ”‚   โ”œโ”€โ”€ reranker.py             # Cross-encoder reranker
โ”‚   โ”‚   โ””โ”€โ”€ cache.py                # Retrieval result cache
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ llm/
โ”‚   โ”‚   โ””โ”€โ”€ groq_client.py          # Cached Groq client with retry
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ uploads/
โ”‚   โ”‚   โ”œโ”€โ”€ storage.py              # Chunked file storage manager
โ”‚   โ”‚   โ”œโ”€โ”€ processor.py            # PDF/ZIP document processor
โ”‚   โ”‚   โ””โ”€โ”€ tasks.py                # Background upload processing
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ rag/
โ”‚   โ”‚   โ””โ”€โ”€ rag_pipeline.py         # RAG pipeline facade
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ””โ”€โ”€ routes.py               # All API endpoints
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ persistence/
โ”‚   โ”‚   โ””โ”€โ”€ postgres.py             # PostgreSQL session storage
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ voice/
โ”‚   โ”‚   โ”œโ”€โ”€ speech_to_text.py       # Groq Whisper STT
โ”‚   โ”‚   โ”œโ”€โ”€ text_to_speech.py       # TTS utilities
โ”‚   โ”‚   โ””โ”€โ”€ voice_utils.py          # Audio helpers
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ utils/
โ”‚   โ”‚   โ””โ”€โ”€ citations.py            # Legal citation formatting
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ health.py                   # Service health checks
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ data/raw/                   # Source PDFs
โ”‚       โ”œโ”€โ”€ constitution_1973.pdf
โ”‚       โ”œโ”€โ”€ ppc.pdf
โ”‚       โ””โ”€โ”€ crpc1898.pdf
โ”‚
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ page.tsx                # Main chat page
โ”‚   โ”‚   โ”œโ”€โ”€ layout.tsx              # Root layout
โ”‚   โ”‚   โ”œโ”€โ”€ globals.css             # Styling
โ”‚   โ”‚   โ”œโ”€โ”€ admin/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ page.tsx            # Admin dashboard
โ”‚   โ”‚   โ””โ”€โ”€ components/
โ”‚   โ”‚       โ”œโ”€โ”€ ChatInterface.tsx   # Chat logic + streaming
โ”‚   โ”‚       โ”œโ”€โ”€ MessageBubble.tsx   # Message rendering
โ”‚   โ”‚       โ”œโ”€โ”€ Sidebar.tsx         # Session history
โ”‚   โ”‚       โ”œโ”€โ”€ FileUploader.tsx    # Chunked upload + progress
โ”‚   โ”‚       โ”œโ”€โ”€ DocumentManager.tsx # Document table
โ”‚   โ”‚       โ”œโ”€โ”€ VoiceButton.tsx     # Voice input/output
โ”‚   โ”‚       โ””โ”€โ”€ LoadingDots.tsx     # Typing animation
โ”‚   โ””โ”€โ”€ package.json
โ”‚
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ entrypoint.sh               # Docker entrypoint
โ”‚   โ””โ”€โ”€ ingest.sh                   # Ingestion runner
โ”‚
โ””โ”€โ”€ streamlit_app.py                # Legacy Streamlit UI

๐Ÿš€ Quick Start

Option 1: Docker (Recommended)

# 1. Clone the repository
git clone https://github.com/Free-devloper/QanoonAI.git
cd QanoonAI

# 2. Configure environment
cp .env.example .env
# Edit .env โ†’ add your GROQ_API_KEY (free at https://console.groq.com)

# 3. Start all services (backend, frontend, postgres, redis, neo4j, celery)
docker-compose up -d

# 4. Run initial ingestion (processes the 3 built-in law PDFs)
docker-compose exec backend python -m backend.ingestion.pipeline

# 5. Open the app
# Chat:  http://localhost:3000
# Admin: http://localhost:3000/admin
# Neo4j: http://localhost:7474

Option 2: Local Development

# 1. Clone and setup Python
git clone https://github.com/Free-devloper/QanoonAI.git
cd QanoonAI
python -m venv venv
venv\Scripts\activate          # Windows
# source venv/bin/activate     # Linux/Mac
pip install -r requirements.txt

# 2. Start required services (Redis, Neo4j, PostgreSQL)
# Install and run them locally, or use Docker for just the infra:
docker-compose up -d postgres redis neo4j

# 3. Configure environment
cp .env.example .env
# Edit .env โ†’ add GROQ_API_KEY, set DATABASE_URL to your local postgres

# 4. Run ingestion
python -m backend.ingestion.pipeline

# 5. Start backend
uvicorn app:app --reload --port 8000

# 6. Start frontend (separate terminal)
cd frontend
npm install
npm run dev

# 7. Open http://localhost:3000

โš™๏ธ Configuration

All settings are configured via environment variables. See .env.example for the full list.

Required Variables

Variable Description Example
GROQ_API_KEY Groq API key (free tier) gsk_xxxx...
DATABASE_URL PostgreSQL connection string postgresql://user:pass@localhost:5432/dbname

Optional Variables

Variable Default Description
REDIS_URL redis://localhost:6379/0 Redis connection
NEO4J_URI bolt://localhost:7687 Neo4j connection
NEO4J_PASSWORD neo4j_password Neo4j auth
LLM_MODEL llama-3.3-70b-versatile Groq model
EMBEDDING_MODEL_LOCAL all-mpnet-base-v2 Local embedding model
TOP_K_RESULTS 6 Number of retrieved chunks
CHUNK_SIZE 800 Text chunk size (chars)

Note: Redis and Neo4j are optional โ€” the system degrades gracefully without them (uses in-memory fallbacks). PostgreSQL is required for session persistence.


๐Ÿ“š Supported Laws

Law File Coverage
๐Ÿ›๏ธ Constitution of Pakistan 1973 constitution_1973.pdf All 280 Articles + Amendments
โš–๏ธ Pakistan Penal Code (PPC) ppc.pdf All 511 Sections
๐Ÿ“‹ Criminal Procedure Code (CrPC) 1898 crpc1898.pdf All 565 Sections

Adding New Documents

  1. Navigate to Admin Dashboard โ†’ http://localhost:3000/admin
  2. Drag & drop PDF or ZIP files onto the upload zone
  3. The system processes them in the background:
    • ZIP โ†’ extract PDFs โ†’ validate โ†’ chunk โ†’ embed โ†’ index
    • Large files (up to 4 TB) are handled via chunked uploads โ€” never loaded into RAM
  4. Check progress in real-time or come back later โ€” processing continues independently

๐Ÿ› ๏ธ Tech Stack

Layer Technology
LLM Groq Cloud (llama-3.3-70b-versatile)
Embeddings Local sentence-transformers/all-mpnet-base-v2 (768-dim)
Reranker cross-encoder/ms-marco-MiniLM-L-12-v2
Vector Store FAISS (IndexFlatIP + IndexIDMap)
Knowledge Graph Neo4j 5 Community
Agent Framework LangGraph (StateGraph)
Backend FastAPI + Uvicorn
Frontend Next.js 14 + React 18 + TailwindCSS
Cache Redis 7 (LLM + embedding + retrieval caching)
Task Queue Celery with Redis broker
Database PostgreSQL 16 (chat session persistence)
Voice Groq Whisper (STT) + Web Speech API (TTS)
Container Docker Compose (7 services)

๐Ÿณ Docker Services

Service Port Description
backend 8000 FastAPI application
frontend 3000 Next.js UI
postgres 5432 Chat session storage
redis 6379 Caching + Celery broker
neo4j 7474 / 7687 Knowledge graph
celery-worker โ€” Background task processing

๐Ÿ“ก API Endpoints

Chat

Method Endpoint Description
POST /api/v1/chat Send a message, get a response
POST /api/v1/chat/stream Streaming response (SSE)

Sessions

Method Endpoint Description
GET /api/v1/sessions List all chat sessions
GET /api/v1/sessions/{id} Get session messages
DELETE /api/v1/sessions/{id} Delete a session
PATCH /api/v1/sessions/{id} Rename a session

Upload & Documents

Method Endpoint Description
POST /api/v1/upload/init Initialize chunked upload
POST /api/v1/upload/chunk Upload a file chunk
POST /api/v1/upload/complete Signal upload done โ†’ triggers background processing
GET /api/v1/upload/progress/{id} SSE progress stream
GET /api/v1/documents List uploaded documents
DELETE /api/v1/documents/{name} Delete a document

System

Method Endpoint Description
POST /api/v1/ingest Trigger document ingestion
GET /api/v1/ingest/status Ingestion pipeline status
GET /api/v1/health Service health check
GET /api/v1/graph/stats Neo4j graph statistics
GET /api/v1/cache/stats Redis cache hit rates

Voice

Method Endpoint Description
POST /api/v1/voice/stt Speech-to-text (audio โ†’ text)

๐Ÿ“ค Large File Upload Architecture

QanoonAI handles files from kilobytes to terabytes without crashing:

Browser                         Backend                          Disk
  โ”‚                               โ”‚                               โ”‚
  โ”‚โ”€โ”€ File.slice(0, 5MB) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚โ”€โ”€ stream 8KB buffer โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚ chunk_000
  โ”‚โ”€โ”€ File.slice(5MB, 10MB) โ”€โ”€โ”€โ”€โ”€โ–บโ”‚โ”€โ”€ stream 8KB buffer โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚ chunk_001
  โ”‚โ”€โ”€ ... (progress bar) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚โ”€โ”€ stream 8KB buffer โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚ chunk_N
  โ”‚                               โ”‚                               โ”‚
  โ”‚โ”€โ”€ POST /upload/complete โ”€โ”€โ”€โ”€โ”€โ–บโ”‚โ”€โ”€ concatenate (8KB buf) โ”€โ”€โ”€โ”€โ–บโ”‚ file.zip
  โ”‚โ—„โ”€โ”€ {"status":"processing"} โ”€โ”€โ”‚                               โ”‚
  โ”‚                               โ”‚                               โ”‚
  โ”‚  โœ… Client can disconnect     โ”‚โ”€โ”€ Background Worker โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚
  โ”‚     here. Processing runs     โ”‚   Extract ZIP (streaming)     โ”‚
  โ”‚     independently.            โ”‚   Validate PDFs               โ”‚
  โ”‚                               โ”‚   Chunk text                  โ”‚
  โ”‚  (Optional: SSE monitoring)   โ”‚   Generate embeddings         โ”‚
  โ”‚โ—„โ”€โ”€ SSE: "embedding 60%" โ”€โ”€โ”€โ”€โ”€โ”‚   Index into FAISS + Neo4j   โ”‚
  โ”‚โ—„โ”€โ”€ SSE: "complete 100%" โ”€โ”€โ”€โ”€โ”€โ”‚                               โ”‚

Peak RAM usage: ~100 MB regardless of file size.


๐Ÿ”ฎ Future Roadmap

  • Authentication & role-based access (admin vs user)
  • Urdu language support (multilingual model + Urdu prompts)
  • RAGAS evaluation framework integration
  • LangSmith monitoring dashboard
  • S3 storage backend for cloud deployments
  • Kubernetes Helm chart
  • Civil law corpus expansion (CPC, Contract Act, Family Law)

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License โ€” see the LICENSE file for details.


๐Ÿ™ Acknowledgments


Built with โค๏ธ for Pakistan's legal community

About

โš–๏ธ๐Ÿ‡ต๐Ÿ‡ฐ Production-Grade Agentic GraphRAG Platform for Pakistani Law โ€” Constitution, PPC & CrPC โ€” powered by LangGraph, FAISS, Neo4j, Groq & Next.js

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages