How shifashah3/workrightsai works
WorkRightsAI is a multilingual assistant for questions about Pakistani labour law. A user enters a question in the React chat; the frontend posts it to FastAPI, which invokes the chatbot and returns its answer. The documented RAG path retrieves relevant legal-text chunks, formats evidence for the model, and returns a cited response, with safety checks and interaction logging. The repository also includes a legal-corpus preparation and indexing path. Those stages and capabilities are documented, but their wiring is not verified from the sampled source excerpts.
Main entry points: chatbot.py RAG chatbot · App.tsx Chat interface · server.py Chat API · embeddings.py Embedding indexer
Components 13
Chat experience
- Chat interface
Work Rights AI frontend/src/app/App.tsx - Message display
Work Rights AI frontend/src/app/components/ChatMessage.tsx
Answer service
- Chat API
server.py - RAG chatbot
chatbot.py - Legal vector store
Legal corpus
- Embedding indexer
embeddings.py - Legal chunking
create_chunks.py - PDF extraction
OCR.py
Safety and audit
- Safety checks
guardrails.py - Interaction log
logger.py
Other components
- Question asker
- Legal PDFs
- Groq LLM
Connections 13
- Question asker → Chat interface: asks
- Chat interface → Chat API: posts question
- Chat API → RAG chatbot: calls ask
- RAG chatbot → Legal vector store: retrieves chunks
- RAG chatbot → Groq LLM: generates answer
- RAG chatbot → Safety checks: checks safety
- RAG chatbot → Interaction log: logs interaction
- Chat API → Chat interface: returns answer
- Chat interface → Message display: renders messages
- Legal PDFs → PDF extraction: extracts text
- PDF extraction → Legal chunking: provides text
- Legal chunking → Embedding indexer: provides chunks
- Embedding indexer → Legal vector store: indexes chunks