Ask questions across IPC sections, Supreme Court judgments, and contracts — powered by RAG, LLaMA3, and ChromaDB.
Legal research in India is slow, expensive, and inaccessible. Finding the right IPC section, understanding a court judgment, or spotting risky contract clauses requires hours of manual reading. LexQuery makes it conversational.
- IPC Q&A — "What is the punishment for culpable homicide?" → cited answer from IPC_1860
- Judgment summarization — "Summarize the Maneka Gandhi judgment" → plain-English answer with source
- Contract analysis — "What does the indemnity clause say?" → answer grounded in the uploaded contract
- Filtered queries — search only IPC, only judgments, or only contracts
| Component | Tool |
|---|---|
| PDF extraction | pdfplumber |
| Chunking | LangChain RecursiveCharacterTextSplitter |
| Embeddings | HuggingFace all-MiniLM-L6-v2 |
| Vector store | ChromaDB |
| LLM | Groq LLaMA3-8b |
| Orchestration | LangChain |
lexquery/
├── data/
│ ├── ipc/ # IPC_1860.pdf
│ ├── judgments/ # landmark SC judgment PDFs
│ └── contracts/ # sample contract PDFs
├── src/
│ ├── ingest.py # load → clean → chunk → embed → store
│ ├── retriever.py # query ChromaDB with optional filters
│ └── chain.py # Groq LLaMA3 QA chain
├── main.py # CLI entry point
├── config.yaml # all settings
├── .env.example # API key template
└── requirements.txt
# 1. Clone
git clone https://github.com/yourusername/lexquery.git
cd lexquery
# 2. Install dependencies
pip install -r requirements.txt
# 3. Set up API keys
cp .env.example .env
# Add your GROQ_API_KEY and HF_TOKEN to .env
# 4. Add PDFs to data/ folders (see Data Sources below)
# 5. Ingest
python main.py --ingest# Query across all documents
python main.py --query "What is the punishment for murder under IPC?"
# Filter by document type
python main.py --query "What does Section 420 say?" --doc_type ipc
python main.py --query "Summarize the Maneka Gandhi judgment" --doc_type judgment
python main.py --query "What are the indemnity terms?" --doc_type contractAll data is publicly available and free to download:
| Type | Source | URL |
|---|---|---|
| IPC 1860 | India Code (Govt. of India) | https://indiacode.nic.in |
| SC Judgments | Indian Kanoon | https://indiankanoon.org |
| SC Judgments | Supreme Court of India | https://sci.gov.in |
| Sample Contracts | TLDR Legal | https://tldrlegal.com |
All settings are in config.yaml — no hardcoded values in code:
embedding:
model: "sentence-transformers/all-MiniLM-L6-v2"
llm:
model: "llama3-8b-8192"
chunking:
chunk_size: 800
chunk_overlap: 100
retrieval:
top_k: 5Swastik — CS Engineering Student, building toward AI Engineering.