Skip to content

alaminXpro/test-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1 Commit
Β 
Β 

Repository files navigation

AskLaw - Comprehensive Legal Assistant Platform

A complete legal assistance platform providing Bangladeshi legal information through multiple channels. The system combines a sophisticated RAG (Retrieval-Augmented Generation) engine with social media automation to help the general public access legal information through their preferred communication channels.

πŸ”„ Message Flow Overview

Here's how user queries flow through our dual-channel system to provide intelligent legal assistance:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           USER QUERY CHANNELS                                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Channel A: Facebook Messenger                    Channel B: Web Application
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   πŸ‘€ User sends     β”‚                          β”‚   πŸ‘€ User types     β”‚
β”‚   message to        β”‚                          β”‚   query in web      β”‚
β”‚   Facebook Page     β”‚                          β”‚   interface         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚                                                β”‚
          β–Ό                                                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  πŸ“˜ Facebook        β”‚                          β”‚  βš›οΈ  React          β”‚
β”‚  Messenger API      β”‚                          β”‚  Frontend           β”‚
β”‚  (Webhook)          β”‚                          β”‚  (Vercel)           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚                                                β”‚
          β–Ό                                                β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  πŸ€– Messenger Bot   β”‚                          β”‚  🌐 Web Backend     β”‚
β”‚  (Spring Boot)      β”‚                          β”‚  (Spring Boot)      β”‚
β”‚                     β”‚                          β”‚                     β”‚
β”‚  β€’ Webhook Handler  β”‚                          β”‚  β€’ REST API         β”‚
β”‚  β€’ User Management  β”‚                          β”‚  β€’ Authentication   β”‚
β”‚  β€’ Message Queue    β”‚                          β”‚  β€’ Session Mgmt     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
          β”‚                                                β”‚
          β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”‚
          β”œβ”€β”€  πŸ“Š MongoDB Atlas  β”‚                       β”‚
          β”‚ β”‚  β€’ User Profiles   β”‚                       β”‚
          β”‚ β”‚  β€’ Message History │◄───────────────────────
          β”‚ β”‚  β€’ Analytics       β”‚                       β”‚
          β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β”‚
          β”‚                                                β”‚
          β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”‚
          └──  πŸ”΄ Redis Queue    β”‚                       β”‚
            β”‚  β€’ Message Buffer  β”‚                       β”‚
            β”‚  β€’ Background Jobs β”‚                       β”‚
            β”‚  β€’ Rate Limiting   β”‚                       β”‚
            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β”‚
                      β”‚                                   β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                🧠 RAG SERVICE                           β”‚
              β”‚                 (FastAPI)                               β”‚
              β”‚                                                         β”‚
              β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”‚
              β”‚  β”‚ πŸ” Query    β”‚  β”‚ πŸ“š Document β”‚  β”‚ 🎯 LangGraphβ”‚    β”‚
              β”‚  β”‚ Analysis    β”‚  β”‚ Retrieval   β”‚  β”‚ Workflow    β”‚    β”‚
              β”‚  β”‚             β”‚  β”‚             β”‚  β”‚             β”‚    β”‚
              β”‚  β”‚ β€’ Scope     β”‚  β”‚ β€’ Semantic  β”‚  β”‚ β€’ Legal     β”‚    β”‚
              β”‚  β”‚ β€’ Intent    β”‚  β”‚ β€’ Keyword   β”‚  β”‚ β€’ Lawyer    β”‚    β”‚
              β”‚  β”‚ β€’ Context   β”‚  β”‚ β€’ Hybrid    β”‚  β”‚ β€’ Answer    β”‚    β”‚
              β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β”‚
              β”‚                                                         β”‚
              β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
              β”‚  β”‚           πŸ“Š Qdrant Vector DB                   β”‚  β”‚
              β”‚  β”‚                                                 β”‚  β”‚
              β”‚  β”‚  β€’ Bangladeshi Laws       β€’ Legal Articles     β”‚  β”‚
              β”‚  β”‚  β€’ Government Portals     β€’ Court Cases        β”‚  β”‚
              β”‚  β”‚  β€’ Legal Precedents      β€’ Lawyer Directory   β”‚  β”‚
              β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                                    β–Ό
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                 πŸ’‘ AI RESPONSE                          β”‚
              β”‚                                                         β”‚
              β”‚  β€’ Structured Legal Answer                              β”‚
              β”‚  β€’ Relevant Law Sections                                β”‚
              β”‚  β€’ Lawyer Recommendations                               β”‚
              β”‚  β€’ Source Citations                                     β”‚
              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                    β”‚
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚                               β”‚
                    β–Ό                               β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  πŸ“± Facebook Response   β”‚          β”‚   🌐 Web Response       β”‚
    β”‚                         β”‚          β”‚                         β”‚
    β”‚  β€’ Formatted Message    β”‚          β”‚   β€’ Rich UI Display     β”‚
    β”‚  β€’ Quick Reply Options  β”‚          β”‚   β€’ Downloadable PDF    β”‚
    β”‚  β€’ Follow-up Prompts    β”‚          β”‚   β€’ Share Options       β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚                                    β”‚
                  β–Ό                                    β–Ό
        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β”‚   πŸ‘€ User       β”‚                  β”‚   πŸ‘€ User       β”‚
        β”‚   receives      β”‚                  β”‚   receives      β”‚
        β”‚   response via  β”‚                  β”‚   response in   β”‚
        β”‚   Messenger     β”‚                  β”‚   browser       β”‚
        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Key Flow Benefits

  • ⚑ Real-time Processing: Instant responses through optimized queuing
  • πŸ”„ Cross-Channel Consistency: Same AI engine powers both channels
  • πŸ“Š Unified Analytics: All interactions stored in centralized database
  • βš–οΈ Legal Accuracy: Specialized RAG pipeline for legal document retrieval

🌟 Access Points

πŸ—οΈ Architecture Overview

This platform consists of two main components working together:

1. Social Media Automation (Facebook Messenger Bot)

  • Repository: JurisMind Backend
  • Purpose: Handles Facebook Page Messenger integration with AI-powered responses
  • Technology: Spring Boot + Redis Queue + MongoDB

2. RAG-Powered Legal Assistant

  • Backend: AskLaw Backend
  • Frontend: AskLaw Frontend
  • Purpose: Core legal information retrieval and processing using advanced NLP
  • Technology: FastAPI + LangChain + LangGraph + Qdrant Vector DB

✨ Key Features

Core Legal Intelligence

  • πŸ“š Comprehensive Legal Database: Trained on scraped Bangladeshi laws, government portals, and legal blogs
  • πŸ” Advanced Search: Hybrid semantic search combining sparse embeddings, dense embeddings, and late interaction embeddings
  • 🧠 Intelligent Workflow: LangGraph-powered decision-making pipeline for different types of legal queries
  • πŸ’Ύ Persistent Memory: Chat history stored in MongoDB for revisiting past queries

Multi-Channel Access

  • πŸ“± Social Media Integration: 24/7 automated responses via Facebook Messenger
  • 🌐 Web Interface: Interactive React-based frontend for detailed legal research
  • ⚑ Real-time Processing: Asynchronous message handling with Redis queues
  • πŸ‘₯ Contact Management: Automatic user profile management and conversation tracking

Technical Excellence

  • πŸ”„ Scalable Architecture: Microservices approach with independent scaling
  • πŸ“Š Analytics & Monitoring: Comprehensive metrics and health checks
  • πŸ§ͺ Robust Testing: Unit, integration, and end-to-end test coverage
  • πŸ“ API Documentation: Complete OpenAPI/Swagger documentation

πŸ”„ RAG Workflow (LangGraph Pipeline)

Legal Query Processing Workflow

Our LangGraph-powered system intelligently processes legal queries through a structured decision tree:

πŸ” Step 1: Legal Scope Detection

  • Node: isLegalScope
  • Function: Determines if the query relates to legal matters
  • Decision: Legal query β†’ proceed to interpretation | Non-legal β†’ fallback response

🎯 Step 2: Query Classification

  • Node: interpret_query_actions
  • Routes:
    • Specific Law Section β†’ specificLaw
    • General Legal Inquiry β†’ doc_retrieval
    • Lawyer Consultation β†’ IdentifyLawyerType

βš™οΈ Step 3: Specialized Processing

  • specificLaw: Direct law section retrieval by number/reference
  • doc_retrieval: Semantic + keyword search through Qdrant vector database
  • IdentifyLawyerType: Legal specialization classification for referrals

πŸ” Step 4: Enhanced Retrieval

  • Node: metadata_based_retrieval
  • Function: Enriches results with law metadata (act names, sections, amendments)

πŸ’‘ Step 5: Answer Generation

  • Node: llm_answer_with_context
  • Function: Generates comprehensive, structured responses using retrieved legal content

🎯 Step 6: Final Routing

  • Lawyer Type Identified β†’ find_lawyers for professional referrals
  • Legal Answer Generated β†’ Direct response to user

πŸ› οΈ Technology Stack

Social Media Automation Layer

Component Technology Purpose
Application Framework Spring Boot 3.0+ Backend service architecture
Language Java 17+ Core application development
Message Queue Redis 7.0+ Asynchronous message processing
Database MongoDB Atlas User profiles and message storage
Integration Facebook Graph API Messenger webhook handling
Documentation SpringDoc OpenAPI API documentation
Testing JUnit 5 + Testcontainers Comprehensive test coverage

RAG Intelligence Layer

Component Technology Purpose
AI Framework LangChain + LangGraph Legal query processing pipeline
Backend API FastAPI High-performance API service
Vector Database Qdrant Hybrid search with multiple embeddings
Language Python 3.8+ RAG pipeline development
Frontend React Interactive web interface
Data Storage MongoDB Legal documents and metadata

πŸš€ Deployment Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Facebook      β”‚    β”‚    Web Users    β”‚    β”‚   Admin Panel   β”‚
β”‚   Messenger     β”‚    β”‚                 β”‚    β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚                      β”‚                      β”‚
      β–Ό                      β–Ό                      β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Load Balancer                                β”‚
β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚                           β”‚
      β–Ό                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Messenger Bot   β”‚         β”‚   RAG Service   β”‚
β”‚ (Spring Boot)   │◄─────────   (FastAPI)     β”‚
β”‚                 β”‚         β”‚                 β”‚
β”‚ β€’ Webhook       β”‚         β”‚ β€’ LangGraph     β”‚
β”‚ β€’ Redis Queue   β”‚         β”‚ β€’ Qdrant DB     β”‚
β”‚ β€’ User Mgmt     β”‚         β”‚ β€’ Legal Engine  β”‚
β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
      β”‚                           β”‚
      β–Ό                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   MongoDB       β”‚         β”‚   React Web     β”‚
β”‚   Atlas         β”‚         β”‚   Frontend      β”‚
β”‚                 β”‚         β”‚   (Vercel)      β”‚
β”‚ β€’ Messages      β”‚         β”‚                 β”‚
β”‚ β€’ Contacts      β”‚         β”‚ β€’ UI/UX         β”‚
β”‚ β€’ Analytics     β”‚         β”‚ β€’ Chat History  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Hosting & Infrastructure

  • πŸ”„ Messenger Bot: Render (with Redis & MongoDB Atlas)
  • 🧠 RAG Service: Render (connected to Qdrant Cloud)
  • 🌐 Frontend: Vercel (optimized for fast global access)
  • πŸ’Ύ Databases: MongoDB Atlas (global clusters)

πŸ“ Project Structure

This repository contains the RAG service component. The complete platform consists of:

AskLaw/
β”œβ”€β”€ README.md                    # This file - project overview
β”œβ”€β”€ AskLaw_RAG/                 # RAG service (FastAPI + LangChain)
β”‚   β”œβ”€β”€ main.py                 # FastAPI application entry point
β”‚   β”œβ”€β”€ graph.py                # LangGraph workflow definition
β”‚   β”œβ”€β”€ connection.py           # Database connections
β”‚   β”œβ”€β”€ requirements.txt        # Python dependencies
β”‚   β”œβ”€β”€ all_law_names.json     # Legal document metadata
β”‚   └── graph_nodes/           # Individual workflow nodes
β”‚       β”œβ”€β”€ isLegalScope.py    # Legal scope detection
β”‚       β”œβ”€β”€ docRetrieval.py    # Document retrieval
β”‚       β”œβ”€β”€ interpretQueryActions.py # Query classification
β”‚       β”œβ”€β”€ specificLaw.py     # Specific law lookup
β”‚       β”œβ”€β”€ llmAnswerWithContext.py # Answer generation
β”‚       └── ...               # Other specialized nodes
└── AskLaw_backend/            # Submodule: Messenger bot service
    └── backend/               # Spring Boot application
        β”œβ”€β”€ src/main/java/     # Java source code
        β”œβ”€β”€ src/test/          # Test suites
        β”œβ”€β”€ pom.xml            # Maven configuration
        └── README.md          # Messenger bot documentation

Related Repositories

πŸš€ Getting Started

Prerequisites

  • Python 3.8+ (for RAG service)
  • Java 17+ (for Messenger bot)
  • Node.js 16+ (for frontend development)
  • Docker (optional, for containerized deployment)

Quick Start - RAG Service

# Clone the repository
git clone --recurse-submodules https://github.com/abtaamim/AskLaw.git
cd AskLaw

# Set up RAG service
cd AskLaw_RAG
pip install -r requirements.txt

# Configure environment variables
cp .env.example .env
# Edit .env with your API keys and database URLs

# Start the RAG service
python main.py

Quick Start - Messenger Bot

# Navigate to messenger bot
cd AskLaw_backend/backend

# Configure environment
cp .env.example .env
# Edit .env with Facebook credentials and database URLs

# Build and run
mvn clean package
mvn spring-boot:run

Environment Configuration

Both services require proper configuration:

RAG Service (.env):

QDRANT_URL=your_qdrant_cluster_url
QDRANT_API_KEY=your_qdrant_api_key
OPENAI_API_KEY=your_openai_api_key
MONGODB_URI=your_mongodb_connection_string

Messenger Bot (.env):

FACEBOOK_VERIFY_TOKEN=your_verify_token
FACEBOOK_PAGE_ACCESS_TOKEN=your_page_token
FACEBOOK_PAGE_ID=your_page_id
MONGODB_URI=your_mongodb_connection_string
REDIS_HOST=your_redis_host
AI_SERVICE_URL=http://localhost:8000/chat  # RAG service URL

πŸ§ͺ Testing

RAG Service Testing

cd AskLaw_RAG
python -m pytest tests/ -v

Messenger Bot Testing

cd AskLaw_backend/backend
mvn test

Integration Testing

Test the complete flow by:

  1. Starting both services locally
  2. Using the web frontend to submit queries
  3. Sending messages to the Facebook page
  4. Monitoring logs and responses

🀝 Contributing

We welcome contributions to improve AskLaw! Here's how you can help:

Development Workflow

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes and add tests
  4. Ensure all tests pass
  5. Submit a pull request with a clear description

Contribution Areas

  • 🧠 AI/ML: Improve RAG pipeline accuracy and performance
  • πŸ“± Integration: Add new social media platforms or communication channels
  • 🎨 Frontend: Enhance user experience and accessibility
  • πŸ“š Legal Content: Expand legal database coverage
  • πŸ”§ DevOps: Improve deployment and monitoring
  • πŸ“ Documentation: Help others understand and contribute

Code Standards

  • Follow existing code style and conventions
  • Write comprehensive tests for new features
  • Update documentation for API changes
  • Use meaningful commit messages

πŸ“Š Performance & Analytics

Key Metrics

  • Response Time: < 2 seconds for most legal queries
  • Accuracy: 85%+ relevance score on legal document retrieval
  • Availability: 99.5% uptime across all services
  • Scalability: Handles 1000+ concurrent users

Monitoring

  • Health Checks: Built-in endpoints for service monitoring
  • Logging: Structured logging with different levels
  • Metrics: Custom metrics for business KPIs
  • Alerts: Automated alerts for service degradation

πŸ“„ License

This project is licensed under the MIT License - see individual repository LICENSE files for details.

πŸ™‹β€β™‚οΈ Support & Community

  • πŸ“§ Email: info@alaminia.com
  • πŸ’Ό LinkedIn: alaminxpro
  • πŸ› Issues: Use GitHub Issues in respective repositories
  • πŸ’¬ Discussions: Join our community discussions

πŸ† Acknowledgments

  • Facebook Developer Community for Messenger platform support
  • LangChain Team for the excellent RAG framework
  • Qdrant for high-performance vector search
  • Spring Boot Community for robust backend framework
  • All Contributors who help make legal information accessible

⭐ Star this repository if you find it useful!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published