Skip to content

A powerful AI-driven agent that answers legal queries related to the Constitution of India and the Indian Penal Code (IPC) using keyword generation, vector search, and smart tool orchestration.

Notifications You must be signed in to change notification settings

akash-d-dev/AI-LegalHelp-Constution-IPC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

34 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ‡ฎ๐Ÿ‡ณ Indian Legal AI Assistant

A powerful AI-driven agent that answers legal queries related to the Constitution of India and the Indian Penal Code (IPC) using keyword generation, vector search, and smart tool orchestration.

image


๐Ÿง  How It Works

  1. User enters a legal query
    โ†’ e.g., "When can the Indian government restrict freedom of speech?"

  2. AI Agent activates tools:

    • ๐Ÿ”‘ generate_keywords โ†’ Extracts keywords like "freedom", "speech", "restrictions"
    • ๐Ÿ“š search_db_constitution โ†’ Searches Indian Constitution vector DB
    • โš–๏ธ search_db_penal_code โ†’ Searches IPC vector DB
    • ๐Ÿ”„ enhanced_cross_domain_legal_search โ†’ Performs parallel searches and cross-references between Constitution and IPC
    • ๐Ÿ”„ Synthesizes all retrieved data into a final answer
  3. Returns structured legal answer
    With referenced articles and sections.


โš™๏ธ System Components

  • generate_keywords: Keyword extractor from user input
  • search_db_constitution: Vector search on Constitution articles
  • search_db_penal_code: Vector search on IPC sections
  • ai_agent: Controls the flow, uses tools, composes the answer

๐Ÿ”ฎ Future Add-on: Predict Punishment from Case

A fine-tuned AI model trained on court judgments to:

  • Predict punishment based on case description
  • Reference relevant IPC sections
  • Suggest similar past judgments

Planned Tool: predict_punishment_from_case


๐Ÿš€ Key Features

  • Smart Search: Multi-stage hybrid search strategy for comprehensive results
  • Cross-Reference: Automatic linking between Constitution and IPC sections
  • Context-Aware: Understands legal context and relationships
  • Fast & Accurate: Optimized vector search with result fusion

๐Ÿ› ๏ธ Tech Stack

  • Python 3.8+
  • Milvus Vector Database
  • OpenAI GPT Models / Google Gemini Models
  • FastAPI Backend

๐Ÿ“‹ Testing & Logs

For test results and detailed logs, check out the generated scripts and logs at:


๐Ÿ“š Data Sources

  • Constitution of India
  • Indian Penal Code (IPC)
  • Legal cross-references database

About

A powerful AI-driven agent that answers legal queries related to the Constitution of India and the Indian Penal Code (IPC) using keyword generation, vector search, and smart tool orchestration.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published