Skip to content

dougdevitre/vetted-legal-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Vetted Legal AI Engine

Fix the reliability gap.

License: MIT Python Contributions Welcome PRs Welcome


The Problem

General-purpose AI models hallucinate legal citations, fabricate case law, and produce unreliable advice. When an attorney submits a brief with fake citations, courts sanction them. When a self-represented litigant follows bad AI advice, they lose their case.

The reliability gap in legal AI is not a minor inconvenience β€” it is a liability risk that undermines trust in the entire system.

The Solution

A Retrieval-Augmented Generation (RAG) engine purpose-built for legal applications. Every response is grounded in verified legal data. Every citation is validated against its source. Every answer carries a confidence score. Every query leaves a complete audit trail.

This is not a chatbot with a legal skin. It is infrastructure for trustworthy legal AI.


Architecture

graph LR
    Q[User Query] --> EMB[Embedding]
    EMB --> VS[Vector Search]
    VS --> CA[Context Assembly]
    CA --> LLM[LLM Generation]
    LLM --> CV[Citation Validator]
    CV --> CS[Confidence Scorer]
    CS --> AL[Audit Logger]
    AL --> R[Verified Response]

    subgraph RAG Pipeline
        EMB
        VS
        CA
    end

    subgraph Validation Layer
        CV
        CS
        AL
    end
Loading

Who This Helps

Audience How This Helps
Legal aid organizations Reliable AI assistance without hallucination risk
Pro bono attorneys Research tool they can trust for real case work
Court self-help centers Provide accurate, sourced information to litigants
Justice tech platforms Embed vetted AI into their applications

Features

  • RAG pipeline with verified legal corpus
  • Citation validation β€” every citation checked against source material
  • Confidence scoring per response (high / medium / low / insufficient)
  • Complete audit trail β€” query, sources, generation, validation logged
  • Jurisdiction-aware retrieval β€” filter by state, federal, or topic
  • Source transparency β€” full provenance chain for every answer
  • Pluggable LLM backend (OpenAI, Anthropic, local models)
  • FastAPI-based REST interface

Tech Stack

Layer Technology
Language Python 3.11+
RAG Framework LangChain
Vector Store ChromaDB
API FastAPI
Validation Pydantic
Testing pytest
Linting Ruff + mypy

Quick Start

git clone https://github.com/dougdevitre/vetted-legal-ai.git
cd vetted-legal-ai
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
uvicorn src.vetted_legal_ai.api.routes:app --reload
# API is now running at http://localhost:8000 β€” see /docs for Swagger UI

Query the RAG Engine

import httpx

response = httpx.post("http://localhost:8000/query", json={
    "question": "What are the grounds for eviction in Missouri?",
    "jurisdiction": "MO",
    "max_sources": 5,
})

result = response.json()
print(result["answer"])
print(f"Confidence: {result['confidence']}")

for cite in result["citations"]:
    print(f"  [{cite['status']}] {cite['case_name']} β€” {cite['citation']}")

See examples/basic_query.py for a complete working example.


Roadmap

Feature Status
RAG pipeline with ChromaDB vector store In Progress
Citation validation against source corpus In Progress
Confidence scoring per response Planned
Jurisdiction-aware retrieval filtering Planned
Pluggable LLM backend (OpenAI, Anthropic, local) Planned
Complete audit trail with query provenance Planned

Justice OS Ecosystem

This repository is part of the Justice OS open-source ecosystem β€” 32 interconnected projects building the infrastructure for accessible justice technology.

Core System Layer

Repository Description
justice-os Core modular platform β€” the foundation
justice-api-gateway Interoperability layer for courts
legal-identity-layer Universal legal identity and auth
case-continuity-engine Never lose case history across systems
offline-justice-sync Works without internet β€” local-first sync

User Experience Layer

Repository Description
justice-navigator Google Maps for legal problems
mobile-court-access Mobile-first court access kit
cognitive-load-ui Design system for stressed users
multilingual-justice Real-time legal translation
voice-legal-interface Justice without reading or typing
legal-plain-language Turn legalese into human language

AI + Intelligence Layer

Repository Description
vetted-legal-ai RAG engine with citation validation
justice-knowledge-graph Open data layer for laws and procedures
legal-ai-guardrails AI safety SDK for justice use
emotional-intelligence-ai Reduce conflict, improve outcomes
ai-reasoning-engine Show your work for AI decisions

Infrastructure + Trust Layer

Repository Description
evidence-vault Privacy-first secure evidence storage
court-notification-engine Smart deadline and hearing alerts
justice-analytics Bias detection and disparity dashboards
evidence-timeline Evidence timeline builder

Tools + Automation Layer

Repository Description
court-doc-engine TurboTax for legal filings
justice-workflow-engine Zapier for legal processes
pro-se-toolkit Self-represented litigant tools
justice-score-engine Access-to-justice measurement
justice-app-generator No-code builder for justice tools

Quality + Testing Layer

Repository Description
justice-persona-simulator Test products against real human realities
justice-experiment-lab A/B testing for justice outcomes

Adoption Layer

Repository Description
digital-literacy-sim Digital literacy simulator
legal-resource-discovery Find the right help instantly
court-simulation-sandbox Practice before the real thing
justice-components Reusable component library
justice-dev-starter-kit Ultimate boilerplate for justice tech builders

Built with purpose. Open by design. Justice for all.


⚠️ Disclaimer

This project is provided for informational and educational purposes only and does not constitute legal advice, legal representation, or an attorney-client relationship. No warranty is made regarding accuracy, completeness, or fitness for any particular legal matter. Always consult a licensed attorney in your jurisdiction before making legal decisions. Use of this software does not create any professional-client relationship.


Built by Doug Devitre

I build AI-powered platforms that solve real problems. I also speak about it.

CoTrackPro Β· admin@cotrackpro.com

β†’ Hire me: AI platform development Β· Strategic consulting Β· Keynote speaking

AWS AI/Cloud/Dev Certified Β· UX Certified (NNg) Β· Certified Speaking Professional (NSA) Author of Screen to Screen Selling (McGraw Hill) Β· 100,000+ professionals trained

About

RAG engine with citation validation, confidence scoring, and audit logs for legal AI

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages