ramanareddy-ai/legal-AI-case-management
3.2
If you are the rightful owner of legal-AI-case-management and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This project implements an AI-powered legal assistant that processes legal documents and generates demand letters using a Retrieval-Augmented Generation (RAG) pipeline.
Legal AI Case Management System
Overview
This project implements an AI-powered legal assistant that:
- Ingests structured medical/legal PDFs
- Uses a Retrieval-Augmented Generation (RAG) pipeline with legal-specific chunking
- Embeds document chunks using
OpenAIEmbeddings
and indexes withChromaDB
- Queries those chunks based on natural-language questions
- Generates demand letters using Jinja2 templates
- Serves the solution via an MCP server built with FastAPI
Prerequisites
- Python 3.10+
- Docker & Docker Compose (optional but supported)
- OpenAI API Key (for embeddings + LLM)
Setup
-
Start services (if using Docker):
docker-compose up -d
-
Install Python dependencies:
pip install -r requirements.txt
-
Ingest PDFs and build vector store:
python app/rag_pipeline.py
Running
-
Launch the MCP API server:
uvicorn app.main:app --reload
-
Generate a demand letter:
python generate_letter.py
Output saved to
generated_letter.txt
.
RAG Workflow
- Chunk PDFs using
PyMuPDF
- Embed text using
OpenAIEmbeddings
(LangChain) - Store vectors in
ChromaDB
- Query using natural language
- Retrieve top-k chunks
- Use Jinja2 to fill demand letter template with contextual info
Dependencies
PyMuPDF
ā Parse PDF filesopenai
,langchain
ā Embedding & LLM pipelinechromadb
ā Vector storagejinja2
ā Demand letter templatingfastapi
,uvicorn
ā MCP REST API server
Repo Structure
āāā app/
ā āāā main.py
ā āāā rag_pipeline.py
ā āāā db.py
ā āāā models.py
āāā templates/
ā āāā demand_letter.jinja2
āāā generate_letter.py
āāā requirements.txt
āāā README.md
ā Deliverables
- ā End-to-end pipeline (PDF ā demand letter)
- ā RAG-based retrieval with chunking & embeddings
- ā MCP server via FastAPI
- ā Sample demand letter generated
- ā This documentation with architecture & instructions
For any questions, feel free to reach out at: ramanadata568@gmail.com