Home
Softono
AI-Lawyer-RAG-with-Deepseek

AI-Lawyer-RAG-with-Deepseek

Open source MIT Python
50
Stars
13
Forks
0
Issues
2
Watchers
11 months
Last Commit

About AI-Lawyer-RAG-with-Deepseek

AI Lawyer is an intelligent reasoning legal assistant powered by DeepSeek , Ollama RAG and LangChain, designed to streamline legal research and document analysis. By leveraging retrieval-augmented generation (RAG), it provides precise legal insights, and contract summarization. With an intuitive Streamlit-based UI, analyze legal documents.

Platforms

Web Self-hosted

Languages

Python

Links

GitHub Stars

βš–οΈ AI Lawyer - RAG with DeepSeek R1

An AI-powered legal chatbot that leverages Retrieval-Augmented Generation (RAG) with DeepSeek R1 and Ollama for advanced legal reasoning.

This chatbot is designed to assist users in understanding complex legal documents, retrieving relevant case laws, and providing structured legal insights. By integrating DeepSeek R1, a sophisticated reasoning model, with the RAG framework, AI Lawyer ensures that responses are grounded in factual legal texts, reducing hallucinations and enhancing reliability. The chatbot can process large legal documents, break them down into meaningful sections, and retrieve the most pertinent information to answer user queries accurately.

Features

  • πŸ“‚ Upload and analyze legal documents (PDFs)
  • πŸ” Retrieve relevant legal information using FAISS vector database
  • πŸ€– Answer legal questions using DeepSeek R1 with Groq
  • πŸ“œ Summarize legal documents
  • πŸ“„ Generate downloadable AI-generated legal reports

https://github.com/user-attachments/assets/003b6247-9faa-4c9a-b9b6-e1311d1d61d5

πŸ“Έ Project Demo

Screenshot 1 Screenshot 2
Screenshot 3 Screenshot 4

πŸ“ Project Structure

    β”œβ”€β”€ frontend.py          # Streamlit UI for AI Lawyer
    β”œβ”€β”€ rag_pipeline.py      # Retrieval-Augmented Generation pipeline
    β”œβ”€β”€ vector_database.py   # FAISS-based vector database
    β”œβ”€β”€ requirements.txt     # Python dependencies
    └── README.md            # Project documentation
    

πŸ› οΈ Technologies Used

  • DeepSeek R1 - AI model for complex reasoning
  • Ollama - Local LLM hosting
  • LangChain - AI framework for LLM applications
  • Streamlit - Frontend UI for chatbot
  • FAISS - Vector search for document retrieval
  • pdfplumber - PDF document processing

βš™οΈ Installation & Setup

1️⃣ Clone the Repository

git clone https://github.com/AbhaySingh71/AI-Lawyer-RAG-with-Deepseek.git
cd AI-Lawyer-RAG-with-Deepseek

2️⃣ Set Up the Virtual Environment

python -m venv venv
source venv/bin/activate  # On macOS/Linux
venv\Scripts\activate  # On Windows

3️⃣ Install Dependencies

pip install -r requirements.txt

Deployment on Streamlit Cloud

1️⃣ Push code to GitHub

git add .
git commit -m "Initial commit"
git push origin main

2️⃣ Deploy on Streamlit

  • Go to Streamlit Cloud β†’ Deploy a new app.
  • Set GROQ_API_KEY in Streamlit Secrets.
  • Click Deploy! πŸŽ‰

πŸš€ Usage

  1. Run the Streamlit application:
  2. streamlit run frontend.py
  3. Upload a legal document (PDF)
  4. Ask legal questions and get AI-powered responses
  5. Download AI-generated legal reports

πŸ“œ How It Works

  1. Upload PDF: Documents are uploaded and processed.
  2. Vector Database: FAISS indexes the document text.
  3. Query Handling: AI retrieves relevant information.
  4. LLM Response: DeepSeek R1 generates answers.
  5. Report Generation: AI generates a downloadable PDF report.

🌐 Deployed Version

The app is deployed on Streamlit! You can check out the live version and explore the analysis on your own:Streamlit App.

🎯 Future Improvements

  • πŸ“ Add support for multiple document formats (DOCX, TXT)
  • ⚑ Improve response speed and accuracy
  • πŸ”— Integrate legal databases for richer context

πŸ“¬ Contact Us

Have questions or need support? Reach out to us at:


🌐 Connect With Me

πŸ™ GitHub | πŸ”— LinkedIn | 🐦 Twitter