How qlong-polax/legal_chatbot_using_graphrag_architecture works
This is a Vietnamese legal-assistance GraphRAG product. The user signs in through the React client, submits a question, and receives a sourced answer after retrieval, graph expansion, and Gemini synthesis; chat state and retrieval traces are persisted. A separate Databricks ETL path prepares legal documents for vector and graph search. The graph follows documented architecture plus sampled calls; several internal stages are represented from README capabilities because their implementation was not excerpted.
Main entry points: app.py HTTP API · lakehouse_pipeline.py Medallion pipeline · graph.py LangGraph workflow · api.js API client
Components 22
User Interface
- App routes
frontend/src/App.jsx - Login and register
frontend/src/pages/Login.jsx - Chat interface
frontend/src/pages/Chat.jsx - API client
frontend/src/services/api.js
Answer Orchestration
- HTTP API
orchestrator/app.py - Authentication
orchestrator/auth.py - LangGraph workflow
orchestrator/graph.py - Intent routing
orchestrator/intent.py - Hybrid retrieval
orchestrator/retrievers.py - Gemini synthesis
Legal Data Platform
- Vector index
- Legal graph
- Medallion pipeline
databricks_platform/src/lakehouse_pipeline.py - Text extraction
databricks_platform/src/html_to_text.py - Legal chunking
databricks_platform/src/chunking.py - Gemini embeddings
databricks_platform/src/gemini_embedding.py - Index writers
databricks_platform/src/sinks.py - ETL entry point
databricks_platform/jobs/run_pipeline.py
Session and State
- Session storage
frontend/src/services/session.js - Conversation database
- Cache and queue
Other components
- Legal user
Connections 24
- Legal user → App routes: uses
README.md - App routes → Login and register: routes to
frontend/src/App.jsx - App routes → Chat interface: routes to
frontend/src/App.jsx - Login and register → API client: calls auth
frontend/src/pages/Login.jsx - Chat interface → API client: sends questions
frontend/src/pages/Chat.jsx - Chat interface → Session storage: reads session
frontend/src/pages/Chat.jsx - API client → Session storage: reads token
frontend/src/services/api.js - API client → HTTP API: HTTP requests
frontend/src/services/api.js - HTTP API → Authentication: validates identity
orchestrator/app.py - HTTP API → LangGraph workflow: runs workflow
orchestrator/app.py - LangGraph workflow → Intent routing: routes intent
orchestrator/graph.py - LangGraph workflow → Hybrid retrieval: retrieves context
orchestrator/graph.py - Hybrid retrieval → Vector index: vector search
README.md - Hybrid retrieval → Legal graph: keyword and graph search
README.md - LangGraph workflow → Gemini synthesis: synthesizes answer
README.md - HTTP API → Conversation database: persists chat
orchestrator/app.py - HTTP API → Cache and queue: checks cache
orchestrator/app.py - ETL entry point → Medallion pipeline: starts stages
databricks_platform/jobs/run_pipeline.py - Medallion pipeline → Text extraction: extracts text
databricks_platform/src/lakehouse_pipeline.py - Medallion pipeline → Legal chunking: builds chunks
databricks_platform/src/lakehouse_pipeline.py - Medallion pipeline → Gemini embeddings: embeds chunks
databricks_platform/src/lakehouse_pipeline.py - Medallion pipeline → Index writers: writes indexes
databricks_platform/src/lakehouse_pipeline.py - Index writers → Vector index: writes vectors
README.md - Index writers → Legal graph: writes graph
README.md