Skip to content
Codebro786Public

About

My major project

Resources

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

BoloNyay · बोलो न्याय

Your voice. Your rights. (आपकी बात, आपके अधिकार।)

BoloNyay helps people in India understand what the law says about their situation. Describe a problem in Hindi or English, by typing or speaking, and BoloNyay finds the exact provisions in the official text of six laws. It explains how they may apply to you and suggests lawful next steps.

Live: bolonyay.streamlit.app

BoloNyay gives legal information for education, not legal advice. For your case, consult a lawyer or your District Legal Services Authority (free legal aid helpline 15100). In an emergency, call 112.

BoloNyay home page on a laptop   A Hindi answer on a phone in dark mode

Features

  • Ask in your own words. BoloNyay separates the facts you gave from its assumptions, identifies the legal issues, and applies each relevant provision to your facts. It asks follow-up questions when something important is missing.
  • Verified citations. Every Article and Section in an answer is checked against the official text. The verbatim text is shown next to the simple explanation, and anything that cannot be verified is labelled.
  • Hindi and English. The language of each question is detected automatically, including Hindi typed in English letters. Answers, labels and spoken audio follow it.
  • Voice. Press the microphone and speak in either language; BoloNyay detects which one you used. Answers can be read aloud.
  • Honest coverage. When a problem needs a law outside the six it covers (family, property, labour, cyber and others), BoloNyay names that law instead of guessing.
  • Dark mode for AMOLED screens. A pure-black theme and a clean, phone-first layout.

The newer web app (frontend/ and backend/) adds three tools:

  • Explain a document: upload an FIR, legal notice or court order to get a plain-language summary, the deadlines and the laws it cites.
  • Draft a letter: a police complaint, RTI application or consumer complaint, ready to print.
  • Browse the law: search all 1,701 provisions.

Screenshots

Light Dark
Laptop Home, light mode, laptop Hindi answer, dark mode, laptop
Phone Home, light mode, phone Hindi answer, dark mode, phone
Web app Web app home, laptop Web app answer, dark mode, phone

Laws covered

All text comes from official Government of India publications. Checksums and editions are recorded in data/corpus.json.

Law Provisions Edition Source
The Constitution of India 504 Articles and Schedules As on 10 September 2026 Legislative Department
Bharatiya Nyaya Sanhita, 2023 (BNS) 358 Sections As on 6 October 2025 India Code
Bharatiya Nagarik Suraksha Sanhita, 2023 (BNSS) 531 Sections As on 6 October 2025 India Code
Bharatiya Sakshya Adhiniyam, 2023 (BSA) 170 Sections As on 6 October 2025 India Code
Right to Information Act, 2005 31 Sections As on 18 November 2025 India Code
Consumer Protection Act, 2019 107 Sections As on 1 September 2026 India Code

The PDFs are parsed into 1,701 provisions, each with its heading, Part or Chapter and page number. They are indexed as 6,515 passages for semantic and keyword search. The index is prebuilt and committed in index/, so the app starts without rebuilding it.

Not covered yet: State laws, case law, the BNSS First Schedule, and family, property, labour, IT, domestic-violence, POCSO and motor-vehicle laws.

How it works

  1. Find the law. Exact citations in the question ("Section 173 BNSS"), everyday topics ("FIR refused") and hybrid search (meaning plus keywords) select the relevant provisions.
  2. Reason. One structured call to the language model applies only those provisions to the user's facts, in the user's language.
  3. Verify. Every Article and Section in the reply is checked against the official text. The statutory text shown to the user always comes from the corpus, never from the model.

More detail is in ARCHITECTURE.md.

Layer Technology
Live site Streamlit 1.41
Web app React 18 + TypeScript (Vite), FastAPI
Orchestration LangChain 0.2, LangGraph
Language model Groq openai/gpt-oss-120b, with fallback to openai/gpt-oss-20b
Speech Groq Whisper (speech to text), gTTS (text to speech)
Search intfloat/multilingual-e5-small embeddings, ChromaDB, BM25

Run locally

You need Python 3.11 and a free Groq API key.

python -m venv .venv
source .venv/bin/activate          # Windows: .venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env               # then add your GROQ_API_KEY
streamlit run app.py

To run the web app instead (needs Node 20+):

cd frontend && npm ci && npm run build && cd ..
uvicorn backend.server:app --port 8000

Then open http://localhost:8000. The first start downloads the embedding model (about 470 MB).

Tests

pip install -r requirements-dev.txt
pytest

The suite has 173 tests covering the parsers, citations, retrieval, Hindi and voice handling, the Streamlit app and the web API. Run pytest -m "not slow" for the quick subset.

Configuration

Name Required Purpose
GROQ_API_KEY Yes, for answers and voice Groq API key
GROQ_MODEL No Chat model (default openai/gpt-oss-120b)
GROQ_FALLBACK_MODEL No Used when the main model is busy (default openai/gpt-oss-20b)
GROQ_MAX_TOKENS No English answer length (default 1200). Hindi always gets at least 2200
CHROMA_DIR No Where the search index is stored

Settings are read from environment variables, Streamlit secrets, or .env. No key is stored in the code.

Deployment

DEPLOYMENT.md covers Streamlit Community Cloud (the live site) and Docker or Hugging Face Spaces (the web app).

Project structure

app.py              Streamlit app (the live site)
src/                Legal engine: parsing, search, reasoning, citations, documents, letters
ui/                 Streamlit theme, components, Hindi/English text
backend/            FastAPI web API
frontend/           React web app
data/               Official PDFs and corpus.json
index/              Prebuilt search index
tests/              Test suite
docs/               Change log, demo report, screenshots

Project updates

Changes made after the 7th-semester end-term evaluation are listed in docs/CHANGES_SINCE_ENDTERM.md.

Privacy

Conversations are not stored. Voice recordings and questions are sent to Groq to produce the transcript and the answer, and answer text is sent to Google to generate speech. Uploaded documents are read in memory and discarded.

License

The text of the Constitution and of the Acts is published by the Government of India. Reproducing the text of enacted law is permitted under Section 52(1)(q) of the Indian Copyright Act, 1957.

About

My major project

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages