Skip to content

HrushikeshAnandSarangi/SahayAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

SahayAI ๐Ÿ‡ฎ๐Ÿ‡ณ

Demystifying complex legal documents with the power of AI. SahayAI transforms dense legal jargon into clear, actionable insights, empowering you to make informed decisions with confidence.

Watch Demo Try Live App

๐ŸŒŸ About The Project

Navigating legal documents can be an intimidating and confusing process for anyone without a law degree. The complex language, critical deadlines, and hidden obligations can lead to misunderstandings and costly mistakes.

SahayAI was built to solve this problem. It's an intelligent legal analysis tool that acts as your personal guide. Simply upload a document, and SahayAI instantly breaks it down, providing you with a clear summary, answers to your questions, and a personalized checklist of actions.

๐ŸŽฅ Demo

Watch the full walkthrough: SahayAI Demo Video

Try it yourself: Live Application

โœจ Key Features

SahayAI offers a multi-faceted analysis through a clean, intuitive interface:

๐Ÿ“„ Key Details

Instantly extracts the most critical information from your documentโ€”parties involved, key dates, notice periods, and important termsโ€”and presents it in a simple, structured format.

๐Ÿง  In-depth Analysis

Delivers plain-English summaries and clear explanations of key clauses, helping you understand the implications of each section without getting lost in jargon.

โ“ Ask a Question

An interactive Q&A feature powered by the document's content. Get direct answers to your specific questions, with guided prompts to help you explore the text.

โœ… Your Personalized Checklist

Generates a custom action plan based on the document's content, with categorized tasks and responsibilities so you know exactly what you need to do next.

๐Ÿ› ๏ธ Technical Architecture

Main Components

Component Purpose Key Files
Backend (Legal_Mcp) Receives uploaded files, extracts text, runs a processing pipeline, and provides a chat-based Q&A interface over the document. app.py, tasks.py, requirements.txt, DockerFile
Frontend (sahayai) A modern Next.js (React) UI that lets users upload documents, view analysis results, and chat with the AI. src/app/**, src/components/**, next.config.ts, DockerFile
Infrastructure Docker-compose and Cloud Build configs to containerise and deploy both services. docker-compose.yml, cloudbuild.yaml
Assets Sample legal notice images used for testing or UI illustration. Legal Documents/*

Backend Highlights

  • Flask API exposing two main routes:

    • POST /process-document โ€“ accepts a file + user role, validates, and runs process_document_pipeline
    • POST /chat โ€“ forwards a question/context pair to chat_with_document
  • Technology Stack:

    • Google Cloud Vision for OCR
    • Google Generative AI for LLM interaction
    • LangChain for document processing
    • PyMuPDF and Pillow for PDF handling
    • Containerised with Python 3.9 and Gunicorn for production

Frontend Highlights

  • Built with:

    • Next.js 15 (standalone output mode)
    • TypeScript
    • Tailwind CSS
    • shadcn/ui components
    • lucide-react icons
  • Features:

    • Global state management via React context (stateContext.tsx)
    • API routes (/api/process, /api/chat) proxy requests to Flask backend
    • Responsive design with modern UI components

๐Ÿš€ Getting Started

Prerequisites

Ensure you have Docker and Docker Compose installed on your system:

Running Locally with Docker

  1. Clone the repository

    git clone https://github.com/HrushikeshAnandSarangi/SahayAI.git
  2. Navigate to the project directory

    cd SahayAI
  3. Set up environment variables

    Create a .env file in the root directory:

    # .env example
    API_KEY="YOUR_API_KEY"
  4. Build and run the application

    docker-compose up --build
  5. Access the application

    The application will be available at http://localhost:3000

Cloud Deployment

A Google Cloud Build script (cloudbuild.yaml) is included to build and push both the frontend and backend images to Google Artifact Registry, preparing them for deployment on services like Cloud Run.

๐Ÿ“‚ Project Structure

.
โ”œโ”€โ”€ Legal_Mcp/              # Flask backend
โ”‚   โ”œโ”€โ”€ app.py
โ”‚   โ”œโ”€โ”€ tasks.py
โ”‚   โ”œโ”€โ”€ DockerFile
โ”‚   โ””โ”€โ”€ requirements.txt
โ”œโ”€โ”€ sahayai/                # Next.js frontend
โ”‚   โ”œโ”€โ”€ src/app/            # Pages and API routes
โ”‚   โ”œโ”€โ”€ src/components/     # UI components
โ”‚   โ”œโ”€โ”€ src/context/        # Global state
โ”‚   โ”œโ”€โ”€ DockerFile
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ Legal Documents/        # Sample legal notice images
โ”œโ”€โ”€ docker-compose.yml
โ”œโ”€โ”€ cloudbuild.yaml
โ””โ”€โ”€ README.md

๐Ÿ‘ฅ Who It's For

SahayAI is designed for a wide range of users who need to navigate the complexities of legal language:

๐Ÿ  Individuals & Consumers

Anyone dealing with personal contracts like rental agreements, employment offers, or terms of service who wants to understand their rights and obligations.

๐Ÿ’ผ Business Owners & Entrepreneurs

For quickly reviewing contracts, NDAs, partnership agreements, and other legal documents, especially when they don't have an in-house legal team.

โš–๏ธ Legal Professionals

Paralegals, law clerks, and even lawyers can use it to get a quick first-pass analysis of documents, saving time and highlighting key areas for deeper review.

๐ŸŽ“ Students & Researchers

A useful tool for law students or academics who need to analyze and summarize large volumes of legal text.

๐Ÿ‘จโ€๐Ÿ’ป Developers

Those looking for a practical, end-to-end example of a modern AI application combining a Python backend with a Next.js frontend, ready for containerized deployment.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ“ž Contact

For questions or support, please reach out through the GitHub repository issues.


SahayAI - Empowering everyone to understand legal documents with AI ๐Ÿš€

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors