# GoGreen DOC-AI

Legal Document Intelligence with 3-Tier RAG

Upload legal documents and get AI-powered summaries, Q&A with citations, and contract risk scoring. Built on a 3-tier RAG architecture — Basic RAG, LangChain RAG (ChatAnthropic + QdrantVectorStore + 5-turn memory), and Graph RAG (entity extraction + BM25 + RRF) — for unmatched accuracy and context.

### 3-Tier RAG

Basic, LangChain, and Graph RAG for maximum retrieval accuracy

### LangChain Powered

ChatAnthropic + QdrantVectorStore + 5-turn conversational memory

### 5-Role RBAC

Admin, Manager, Lawyer, Paralegal, and Viewer access control

## Powered by LangChain

### LangChain Integration

- ChatAnthropic for Claude-powered generation
- QdrantVectorStore for vector retrieval
- ConversationBufferWindowMemory (5 turns)
- RetrievalQAChain with source documents
- Streaming responses via LangChain callbacks
- Custom document loaders and splitters

### Why LangChain?

- Modular chain composition for complex workflows
- Built-in memory management across sessions
- Seamless Anthropic Claude integration
- Production-ready vector store connectors
- Extensible retrieval strategies
- Active open-source ecosystem

## Platform Features

### Document Upload & Processing

Upload legal documents in any format. AI extracts text, metadata, and structure for intelligent analysis.

- PDF, DOCX, and image upload support
- OCR for scanned documents
- Automatic metadata extraction
- Document versioning and history
- MinIO object storage backend
- Batch upload and processing

### AI Summarization & Q&A

Get instant summaries and ask natural language questions about your documents with cited answers.

- One-click document summarization
- Natural language Q&A with citations
- Page-level source references
- Multi-document cross-referencing
- Powered by Claude via LangChain ChatAnthropic
- 5-turn conversational memory

### Contract Analysis & Risk Scoring

AI-powered contract review that identifies risks, obligations, and key clauses with confidence scoring.

- Automated risk scoring (Low/Medium/High/Critical)
- Obligation and deadline extraction
- Key clause identification
- Non-standard term detection
- Liability and indemnification analysis
- Renewal and termination tracking

### LangChain RAG Pipeline

Advanced retrieval-augmented generation using LangChain with ChatAnthropic, QdrantVectorStore, and 5-turn memory.

- LangChain ChatAnthropic integration
- QdrantVectorStore for vector search
- OpenAI Embeddings (3072-dimensional)
- 5-turn conversational memory buffer
- Contextual retrieval with re-ranking
- Streaming response generation

### 3-Tier RAG Architecture

Three levels of retrieval — Basic RAG, LangChain RAG, and Graph RAG — for maximum accuracy and context.

- Tier 1: Basic RAG (cosine similarity search)
- Tier 2: LangChain RAG (ChatAnthropic + QdrantVectorStore)
- Tier 3: Graph RAG (entity extraction + relationships)
- BM25 sparse retrieval for keyword matching
- Reciprocal Rank Fusion (RRF) scoring
- Hybrid dense + sparse retrieval

### 5-Role RBAC & Multi-Tenancy

Enterprise role-based access control with Admin, Manager, Lawyer, Paralegal, and Viewer roles.

- 5 roles: Admin, Manager, Lawyer, Paralegal, Viewer
- Multi-tenant workspace isolation
- Document-level permission controls
- Audit trail for all actions
- Team collaboration features
- SSO and OAuth integration

## 3-Tier RAG Architecture

### Tier 1: Basic RAG

Direct cosine similarity search against Qdrant vector store with OpenAI 3072-dimensional embeddings.

### Tier 2: LangChain RAG

ChatAnthropic + QdrantVectorStore + 5-turn conversational memory buffer for contextual multi-turn Q&A.

### Tier 3: Graph RAG

Entity extraction, relationship mapping, BM25 sparse retrieval, and Reciprocal Rank Fusion (RRF) for maximum accuracy.

## Tech Stack

Next.js 16, FastAPI (Python), TypeScript, PostgreSQL, Qdrant, Redis, MinIO, LangChain, Docker, Nginx

## AI Models

Claude (via LangChain ChatAnthropic), OpenAI Embeddings (3072-dim)

## Transform Your Legal Document Workflow

Upload, analyze, and understand legal documents in seconds with 3-tier RAG intelligence powered by LangChain and Claude.
