This project integrates Knowledge Graphs with a Retrieval-Augmented Generation system for smarter interactions with the Indian Income Tax Act. It addresses common limitations in legal document querying by emphasizing the interconnectedness of tax laws, making it easier to navigate complex regulations.
The Income Tax Act Knowledge Graph + RAG System is a sophisticated hybrid solution that leverages Knowledge Graph technology alongside Retrieval-Augmented Generation (RAG) to facilitate intelligent querying of the Indian Income Tax Act. This innovative approach significantly enhances the querying capabilities for complex legal documents, addressing the challenges that traditional RAG systems face when dealing with interconnected legalities.
Legal documents often comprise intricate connections and references among various sections. The system excels where traditional RAG fails, specifically in answering queries such as:
This system incorporates a Knowledge Graph that efficiently handles:
The architecture comprises distinct modules working in tandem, outlined as follows:
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Tax Act Text │───▶│ Parser Module │───▶│ Knowledge Graph│
└─────────────────┘ └──────────────────┘ └─────────────────┘
│ │
▼ │
┌──────────────────┐ │
│ Vector Store │ │
│ (RAG) │ │
└──────────────────┘ │
│ │
▼ ▼
┌──────────────────────────────────────┐
│ Hybrid Query System │
│ • KG Queries (relationships) │
│ • RAG Queries (content) │
│ • Hybrid Queries (both) │
└──────────────────────────────────────┘
The system facilitates various query types:
# What sections reference Section 80C?
response = query_system.query("What sections reference Section 80C?")
# Returns: Sections that reference Section 80C:
# • Section 80TTB: Deduction in respect of interest on deposits...
# Eligibility questions
response = query_system.query("What exemptions are available for senior citizens?")
# Combines: KG to find exemption sections + RAG for senior citizen content
# Detailed explanations
response = query_system.query("Explain Section 44AD for presumptive taxation")
# Specific information
response = query_system.query("What is the penalty for not filing returns?")
The repository is organized for optimal usability:
ita-kg/
├── tax_parser.py # Income Tax Act text parser
├── knowledge_graph.py # Neo4j Knowledge Graph builder
├── hybrid_query_system.py # Query routing and processing
├── main.py # Interactive system
├── demo.py # Capabilities demonstration
├── sample_income_tax_act.txt # Sample tax act data
├── requirements.txt # Python dependencies
├── .env.example # Environment template
└── README.md # Documentation file
This system offers several key advantages:
No comments yet.
Sign in to be the first to comment.