Despite the public availability of Ethiopia’s Constitution and core legal codes, their complexity and formality make them difficult to understand and apply in real-life situations. This project presents a conversational Legal AI Assistant that simplifies and contextualizes Ethiopian law through semantic search, article-cited reasoning, and user-friendly interaction. Powered by LangChain, ChromaDB, HuggingFace embeddings, Groq-hosted LLaMA 3, and Streamlit, the assistant explains legal provisions in plain language, interprets case scenarios, and offers grounded insights into potential consequences—bridging the gap between legal text and practical understanding.
While Ethiopia’s legal codes are public and searchable, applying them meaningfully to specific real-world situations remains complex. For example, determining the potential penalty for a hit-and-run while intoxicated requires cross-referencing the Criminal Code’s traffic, homicide, and sentencing provisions. Few tools exist today that connect a case narrative—its context, evidence, and relevant laws—to a grounded legal interpretation.
Traditional databases provide raw text search but lack the ability to process full case context or offer structured reasoning. Meanwhile, generic AI models may hallucinate answers or misrepresent punitive statutes, undermining user trust in legal applications. There’s a gap between legal literacy and legal applicability—especially when users seek not just what the law says, but what it might mean for them in practice.
This project addresses that gap by delivering a context-sensitive legal assistant that reasons from Ethiopia’s laws to real-world outcomes. Whether asked to explain due process rights or to assess potential sentences from a case description, the assistant provides grounded, article-cited responses. In doing so, it transforms passive access into proactive understanding—where the law begins to answer back.
This project combines retrieval-augmented generation (RAG), structured prompt engineering, and vector-based search to deliver grounded legal reasoning through natural-language interaction. The assistant is trained on the Ethiopian Constitution, Civil Code, and Criminal Code, and is engineered to interpret user queries and case descriptions while maintaining legal accuracy and relevance.
The system is composed of four main layers:
Document Store
sentence-transformers/all-MiniLM-L6-v2
for semantic embeddingsLLM Reasoning Engine
langchain_groq.ChatGroq
Prompt Layer (Chain of Thought for Law)
Interfaces
summary_title
metadataThe diagram below illustrates how the assistant is structured across four layers—data ingestion, retrieval, reasoning, and interaction:
To run the Legal AI Assistant locally:
Installation
git clone https://github.com/Abenezer-Baheru/Legal_AI_Assistant.git cd Legal_AI_Assistant pip install -r requirements.txt
Create a .env
file with the following variables:
API_KEY=your_groq_key
Usage
You can interact with the assistant in three modes:
A. Command Line Interface (CLI)
Run the assistant directly in your terminal:
python app/query_and_answer.py
B. User Interface (UI)
FastAPI Backend
Start the API server for LLM-powered legal QA:
uvicorn app.main:app --reload
This launches the backend at http://localhost:8000, which powers the frontend.
Streamlit UI
In a separate terminal, launch the web interface:
streamlit run frontend/streamlit_app.py
This opens the assistant in your browser at http://localhost:8501, where you can chat using a clean, interactive interface.
The Legal AI Assistant was tested locally on five foundational use cases, confirming its ability to reason accurately across key areas of Ethiopian law. While formal deployment and benchmarking are still in progress, early results indicate strong alignment between user input and relevant legal responses.
Core capabilities were validated:
Constitution-Based Queries
Accurately responds to questions involving constitution.
Civil Code-Based Queries
Successfully interprets obligations and property law.
Criminal Code-Based Queries
Maps case scenarios to relevant offenses and penal provisions.
Out-of-Context Questions
Detects when legal context is insufficient and responds appropriately.
Case-Based Legal Reasoning
Synthesizes law and facts to infer potential punishments with proper grounding.
The Legal AI Assistant is designed to answer questions grounded in Ethiopia’s Constitution, Civil Code, and Criminal Code. Below is a breakdown of supported and unsupported query types, along with examples.
Category | Example Query | Support Status | Notes |
---|---|---|---|
Constitutional Rights | “What does the Constitution say about freedom of religion?” | ✅ Supported | Grounded in FDRE Constitution |
Penal Consequences | “What is the punishment for theft under Ethiopian criminal law?” | ✅ Supported | Based on Criminal Code articles |
Civil Obligations | “What are the legal obligations in a marriage contract?” | ✅ Supported | Drawn from Civil Code provisions |
Procedural Duties | “What steps must be followed to file a constitutional complaint?” | ✅ Supported | Covers legal procedures and filing requirements |
Legal Definitions | “Define ‘contract of adhesion’ under Ethiopian civil law.” | ✅ Supported | Extracted from statutory definitions |
Case Law / Precedents | “What did the Supreme Court rule in the 2021 land dispute case?” | ❌ Unsupported | No access to judicial decisions or court rulings |
Multilingual Queries | “እባክህ የተቃወም መብት አለ?” (Amharic input) | ❌ Unsupported | Only English input/output supported at this stage |
Real-Time Legal Updates | “What are the latest amendments to the Labour Proclamation?” | ❌ Unsupported | Static documents only; no live updates from government/legal portals |
Legal Advice | “What should I do if I’m accused of fraud?” | ❌ Unsupported | Provides information, not personalized legal counsel |
The Legal AI Assistant for Ethiopia shows strong promise as a foundational tool for civic education and legal understanding. Planned enhancements include:
No. | Feature | Description |
---|---|---|
1 | Amharic and Multilingual Support | Make the assistant accessible to non-English speakers through Amharic and regional languages. |
2 | Case Law and Proclamation Integration | Incorporate judicial precedents and proclamations for more dynamic and legally grounded responses. |
3 | Judgment Prediction Benchmarks | Evaluate the assistant’s ability to predict potential legal consequences from real-world case narratives. |
4 | Analytics and Feedback Loop | Use user feedback to refine retrieval, chunking logic, and prompt strategies for accuracy and relevance. |
5 | Deployment and Public Access | Launch a secure, hosted version suitable for legal aid, public institutions, and civic platforms. |
6 | Educational Mode and Scenario Explorer | Offer interactive walkthroughs and legal simulations to support students and civic education. |
Explore the full source code, CLI tools, UI, and model configuration on GitHub:
github.com/Abenezer-Baheru/Legal_AI_Assistant
Maintenance Status: Active — under ongoing development and refinement
Support: For issues or feature requests, please open a GitHub issue or contact via ReadyTensor profile.