🚀 What Is LegalEase AI?
LegalEase AI is a full-stack legal research assistant that:
- Performs fast, intelligent semantic search across legal documents
- Answers natural language legal questions using a Gemini-powered agent
- Supports metadata filtering and document classification
- Includes both a CLI and Flask web UI
- Uses MindsDB for all intelligent querying and indexing
🧱 Stack I Used
Component | Tech |
---|---|
Backend | Flask + MindsDB SDK |
Vector Store | PostgreSQL + pgvector |
Embeddings |
mxbai-embed-large via Ollama |
Reranking | Gemini 2.0 Flash |
Frontend | HTML, Bootstrap, styles.css
|
Infra | Docker (for Ollama, PostgreSQL, MindsDB) |
🔍 Key Features
1. Semantic Search via MindsDB KB
SELECT *
FROM legal_kb_pg
WHERE content LIKE 'Miranda rights'
AND metadata['category'] = 'Criminal Law';
2. PGVector Indexing
CREATE INDEX ON KNOWLEDGE_BASE legal_kb_pg;
3. Scheduled Job Ingestion
CREATE JOB ingest_from_csv
AS (
INSERT INTO legal_kb_pg
SELECT * FROM files.legal_docs
WHERE doc_id > LAST;
)
EVERY 1 HOUR;
4. Gemini Agent with KB Attached
CREATE AGENT legal_gemini_agent
USING
model = 'gemini-2.0-flash',
google_api_key = '<your-key>',
include_knowledge_bases = ['legal_kb_pg'],
prompt_template = 'You are LegalEase AI, a legal research assistant. Question: {{question}}';
📸 User Interface
-
/search
: Ask legal questions and see search results with relevance scores. -
/agent
: Ask natural questions like "What happened in Roe v. Wade?" -
/upload
: Insert new legal documents into the KB. -
/jobs
: View or create automatic ingestion jobs. -
/initialize
: Create your KB and Agent in one click.
All queries are handled via MindsDB and routed through Gemini and Ollama for reasoning + embeddings.
🐞 Bug Report & Open Source Contribution
I also discovered and reported a real-world issue while integrating MindsDB and Ollama:
🔗 View my GitHub Issue on MindsDB
This was a great experience contributing back to a platform that’s been super helpful.
📁 GitHub Repository
🔗 https://github.com/sharmachaitanya945/legalease
Includes:
-
README.md
with setup instructions -
queries.py
for full KB + agent automation -
styles.css
, templates,SUBMISSION.md
, andCONTRIBUTING.md
💬 Want to Collaborate?
I’d love to work with others on expanding this project:
- Add chat memory
- Create an LLM Router
- Multi-KB and table question merging
🧑💻 See CONTRIBUTING.md
🧠 Summary
LegalEase AI shows how MindsDB can power:
- Embedded knowledge search
- Semantic metadata filtering
- RAG-style agentic reasoning
- A full legal research pipeline!
Thanks to the MindsDB team and this amazing community 🙏
Happy to answer any questions or hear your feedback below! 👇
Built with ❤️ by sharmachaitanya945 using MindsDB, Ollama, Gemini & Flask.