LAWGIC is an AI-powered legal consultancy system designed to help common people understand legal issues in simple language.
Instead of reading complex law books, users can ask questions in natural language, and the system will:
- Find relevant legal information from a dataset
- Analyze it using AI
- Provide clear, structured, and easy-to-understand answers
To build a smart legal assistant that:
- Simplifies complex legal content
- Provides quick legal guidance
- Bridges the gap between law and common people
This project uses: RAG (Retrieval-Augmented Generation)
- Smart legal query understanding
- Dataset-based answers (not random AI guesses)
- Structured output (Explanation, Rights, Steps)
- Chat-based interface
User → Frontend → Backend → Retrieval System → AI Model → Response
- Data Handling: Pandas
- Embeddings: Sentence Transformers
- Vector Database: FAISS
- LLM: Gemini API
- Backend: Python (FastAPI)
- Frontend: HTML, CSS, JavaScript
- Legal Data Collection (CSV dataset)
- Data Cleaning & Row Structuring (combine_row → structured legal paragraphs)
- Context-Aware Chunking (row-wise legal sections)
- Embedding Generation (SentenceTransformer: all-MiniLM-L6-v2)
- FAISS Index Creation & Storage (vector + text mapping)
- API Initialization (FastAPI + load models once)
- User Query Input (POST request via API)
- Query Embedding (same embedding model)
- Similarity Search (FAISS Top-K = 3 relevant laws)
- Context Extraction (retrieve legal texts)
- Prompt Engineering (structured legal reasoning format)
- LLM Processing (Gemini generates legal advice)
- Response Formatting (structured output: section, condition, punishment, note)
- API Response Delivery (JSON output to client)
User: "My landlord is not returning my security deposit."
Output:
- Explanation of tenant rights
- Legal steps
- Practical guidance
User asks → System finds law → AI explains
LAWGIC = Search legal data + Explain using AI