A Streamlit-based multilingual legal assistant for Pakistani Family Law, offering legal consulting, automated petition drafting, and citation retrieval—powered by OpenAI and Groq APIs.
Wakeel is a browser-based legal help desk application for users seeking guidance under Pakistani family law. It provides three key services:
- Legal Consulting: Ask questions in English or Urdu and get AI-generated responses tailored to both legal professionals and the general public.
- Petition Drafting: Auto-generate formal legal petitions (e.g., Khula, Custody, Maintenance) based on user input.
- Citations Retrieval: Get summaries of Pakistani case law, statutes, and legal commentary relevant to a specific family law query using RAG (Retrieval-Augmented Generation).
wakeel/
│
├── main.py # Entry point, handles routing and layout
├── requirements.txt # Dependencies
├── tabs/
│ ├── __init__.py # Imports tab modules
│ ├── legal_consulting.py # Chat interface using finetuned OpenAI model ("ft:gpt-4o-2024-08-06:iml-research:wakeel:BW4oryHJ")
│ ├── petition_drafting.py # Petition drafting with Groq LLM (llama3-70b-8192)
│ └── citations_retrieval.py # RAG pipeline using OpenAI Embeddings,Chroma DB, and Groq LLM (llama3-70b-8192)
├── data/
│ └── RAGdata.txt # Source data used in citation retrieval
└── .streamlit/
└── secrets.toml # API keys (ignored by Git)
git clone https://github.com/yourusername/wakeel.git
cd wakeel
It's recommended to use a virtual environment:
pip install -r requirements.txt
Create a .streamlit/secrets.toml
file (excluded from Git) with the following format:
OPENAI_API_KEY = "sk-..."
GROQ_KEY = "gsk-..."
streamlit run main.py
- Uses a fine-tuned OpenAI model (
ft:gpt-4o-...
) - Explains answers in both English and Urdu
- Covers topics like maintenance, child custody, nikah, polygamy, inheritance, etc.
- Choose between Khula, Child Custody, or Maintenance petitions
- Dynamically generated input forms
- Generates formatted legal petitions via Groq API
- Allows downloading as
.txt
- Performs semantic search over law corpus using OpenAI embeddings
- Fetches relevant cases, statutes, summaries
- Response format includes Summary, Laws, Case Law, Key Points
- Refuses queries outside Pakistani family law domain
Sensitive credentials (API keys) are stored in .streamlit/secrets.toml
and not committed to Git.
-
A user can ask: "میرے شوہر نے 6 ماہ سے خرچہ نہیں دیا، میں کیا کر سکتی ہوں؟" → Legal advice in Urdu and English
-
A paralegal needs to draft a Khula petition → Fill form → Generate → Download
-
A student wants case law on “custody after divorce” → Citation tab provides PLD, SCMR, and summaries
- Add voice-to-text input via Whisper
- Expand domain coverage to criminal and civil law
If you'd like to contribute, please fork the repository and submit a pull request. Issues and suggestions welcome!
MIT License