Skip to content

vikrant-project/vikrant-legal-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vikrant Legal Assistant

Offline AI legal assistant for Indian law. Runs 100% on your own machine — no internet, no API keys, no data leaves your laptop. Powered by a fine-tuned 7B GGUF model and a native Windows WPF (.NET 8) UI built on LLamaSharp.

Windows .NET LLamaSharp Model License Release


What it does

Ask plain-English (or Hindi) questions about:

  • Penal codes — IPC / BNS, CrPC / BNSS, BSA (Indian Evidence Act)
  • Civil & commercial — CPC, Indian Contract Act, Companies Act, Consumer Protection Act
  • Special acts — Motor Vehicles Act, Income Tax Act, RTI, IT Act
  • Constitutional law — fundamental rights, writs, articles
  • Procedure — FIR, bail, anticipatory bail, summons, notices, charge sheets

The assistant cites section numbers and Act names where relevant and finishes every legal-information reply with a one-line disclaimer that this is general information, not legal advice.


Install (end users)

All downloads come from this repo's Latest Release. You will download four files in total — the installer plus three model parts — and reassemble the model with one command.

Step 1 — Download the installer

File Size Download
VikrantLegal-Setup.exe ~48 MB Release asset

Step 2 — Download all three model parts (they reassemble into one ~4.07 GB file)

GitHub caps a single release asset at 2 GB, so the model is split into 3 parts. Save all three into the same folder.

File Size MD5 Download
vikrant-legal-assistant.gguf.part_00 ~1.50 GB 69bff04aad3f7b3753f14f77d3636917 Release asset
vikrant-legal-assistant.gguf.part_01 ~1.50 GB d7621fbf661795fa5803cd455957be2f Release asset
vikrant-legal-assistant.gguf.part_02 ~1.17 GB 86bbb632a4e1e96fb6694d6e2f058abd Release asset

Step 3 — Reassemble the model

Open a terminal in the folder containing the three .part_* files and run one of the following:

Windows (cmd.exe)

copy /b vikrant-legal-assistant.gguf.part_00 + vikrant-legal-assistant.gguf.part_01 + vikrant-legal-assistant.gguf.part_02 vikrant-legal-assistant.gguf

Windows (PowerShell)

cmd /c "copy /b vikrant-legal-assistant.gguf.part_00 + vikrant-legal-assistant.gguf.part_01 + vikrant-legal-assistant.gguf.part_02 vikrant-legal-assistant.gguf"

macOS / Linux

cat vikrant-legal-assistant.gguf.part_0{0,1,2} > vikrant-legal-assistant.gguf

Step 4 — Verify and install

# verify the reassembled model
Get-FileHash vikrant-legal-assistant.gguf -Algorithm MD5
# Expected: 5CA543E38B051E772FFF3E69C5F7581A

# verify the installer
Get-FileHash VikrantLegal-Setup.exe -Algorithm MD5
# Expected: D333881A7DA817520E8CEE01F2ACF6F6

Place VikrantLegal-Setup.exe and the reassembled vikrant-legal-assistant.gguf in the same folder, then double-click the installer. The Inno Setup wizard installs the app and copies the model into C:\Program Files\VikrantLegal\. Launch from Start Menu / Desktop. First load takes 30–60 seconds while the model is mapped into memory.

Once the model is reassembled and verified, you can safely delete the three .part_* files.

System requirements: Windows 10 / 11 64-bit · CPU with AVX2 · 6 GB free RAM · 5 GB free disk. GPU is not required — inference runs on CPU for maximum compatibility.


How it compares

Vikrant Legal ChatGPT (web) LawGPT.ai Spellbook Lexis+ AI Casetext CoCounsel
Indian-law focused ❌ general ❌ US-centric ❌ contracts only ⚠️ India edition $$$ ❌ US
Runs 100% offline
No API key / subscription
Data never leaves device
Open source ✅ MIT
One-time install ✅ free ❌ $20/mo ❌ subscription ❌ enterprise ❌ enterprise ❌ enterprise
Cites IPC / CrPC / BNS ⚠️ hallucinations common ⚠️
Hindi support ✅ on request ⚠️ ⚠️
GPU required ❌ CPU only n/a (cloud) n/a n/a n/a n/a
Tech stack C# WPF · LLamaSharp · GGUF proprietary proprietary proprietary proprietary proprietary

Why offline matters for legal work: client privilege, NDAs, sealed matters, and Section 126 of the Indian Evidence Act all argue against shipping case facts to a third-party LLM provider. Vikrant runs on your laptop — the model never makes a network call.


Architecture

┌──────────────────────────────────────────────────────┐
│  VikrantLegal.exe  (WPF, .NET 8, self-contained)    │
│  ┌────────────────────────────────────────────────┐  │
│  │  Views/MainWindow.xaml(.cs)                    │  │
│  │  - chat bubbles, streaming, suggestions, stop  │  │
│  └────────────────────┬───────────────────────────┘  │
│                       │                              │
│  ┌────────────────────▼───────────────────────────┐  │
│  │  Services/LlmService.cs                        │  │
│  │  - LLamaSharp ChatSession + InteractiveExecutor│  │
│  │  - SanitizeHistory() enforces strict           │  │
│  │    user/assistant alternation                  │  │
│  │  - System prompt = Indian-law specialisation   │  │
│  └────────────────────┬───────────────────────────┘  │
│                       │                              │
│  ┌────────────────────▼───────────────────────────┐  │
│  │  llama.cpp native (CPU, AVX2 / AVX-512)        │  │
│  │  via LLamaSharp.Backend.Cpu 0.19.0             │  │
│  └────────────────────┬───────────────────────────┘  │
│                       │                              │
│  ┌────────────────────▼───────────────────────────┐  │
│  │  vikrant-legal-assistant.gguf  (4.07 GB)       │  │
│  │  Saul-Instruct-v1 · Q4_K_M quantisation        │  │
│  └────────────────────────────────────────────────┘  │
└──────────────────────────────────────────────────────┘

Key design decisions

  • CPU-only by default (GpuLayerCount = 0) — broadest compatibility, no CUDA / Vulkan / DirectML headaches on user machines.
  • 4 K context window — fits typical multi-turn legal Q&A; raise in LlmService.LoadModel if you have RAM headroom.
  • Native log capture — every llama.cpp message is written to %APPDATA%\VikrantLegal\llm_load.log for field debugging.
  • Strict role alternationSanitizeHistory() collapses orphan / duplicate roles in ChatHistory so cancelled streams can't poison the next turn.

Build from source

Prerequisites

  • .NET 8 SDK (dotnet --version8.0.x)
  • Optional for installer: Inno Setup 6 (Windows) or Wine + Inno (Linux build host)

Build the app

git clone https://github.com/vikrant-project/vikrant-legal-assistant.git
cd vikrant-legal-assistant

dotnet publish -c Release -r win-x64 --self-contained -o publish

Output → publish/VikrantLegal.exe plus all native deps (LLamaSharp, llama.cpp variants, WPF runtime).

Build the installer (optional)

# Windows
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer.iss

# Linux (Wine)
WINEARCH=win64 WINEPREFIX=~/.wine wine \
  ~/.wine/drive_c/Program\ Files\ \(x86\)/Inno\ Setup\ 6/ISCC.exe installer.iss

Output → dist/VikrantLegal-Setup.exe.


Model

The runtime model is Saul-Instruct-v1, a 7B-parameter law-specialised model fine-tuned on multi-jurisdiction legal corpora, then quantised to Q4_K_M GGUF for efficient CPU inference.

  • Filename (after reassembly): vikrant-legal-assistant.gguf
  • Final size: 4,368,439,488 bytes (4.07 GB)
  • Final MD5: 5ca543e38b051e772fff3e69c5f7581a
  • Distribution: three split parts attached to each GitHub Release (see install section)
  • Upstream weights: Equall/Saul-Instruct-v1 on Hugging Face

Project layout

vikrant-legal-assistant/
├── App.xaml / App.xaml.cs           — WPF application entry
├── Assets/                          — icons & images
├── Services/
│   ├── ChatMessage.cs               — chat-bubble view-model
│   └── LlmService.cs                — LLamaSharp wrapper + history sanitiser
├── Views/
│   ├── MainWindow.xaml              — chat UI
│   └── MainWindow.xaml.cs           — UI logic, streaming, cancellation
├── installer.iss                    — Inno Setup script
├── VikrantLegal.csproj              — .NET project file
└── README.md

Disclaimer

Vikrant Legal Assistant produces general legal information for educational and research purposes. Outputs are AI-generated and may be incomplete, outdated, or wrong. Nothing in this app constitutes legal advice or creates an attorney–client relationship. For your specific matter, consult a qualified advocate enrolled with a State Bar Council under the Advocates Act, 1961.


License

MIT — see LICENSE.

The bundled model vikrant-legal-assistant.gguf is derived from Equall's Saul-Instruct-v1, which is released under the MIT License. LLamaSharp and llama.cpp are MIT-licensed.


Acknowledgements

About

Offline AI legal assistant for Indian law (IPC/BNS, CrPC/BNSS, CPC, Constitution). Native Windows WPF + LLamaSharp + GGUF. 100% on-device, no API keys.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors