An intelligent, scalable chatbot designed to assist users in understanding Indonesian Law regulations. Employs Advanced RAG with Re-ranking to ensure high accuracy and context-aware responses based on official legal documents.
- Scalable Vector DB: Migrated from local SQLite to a standalone ChromaDB Client/Server architecture within Docker Compose.
- Asynchronous Execution: Implemented
achat()in FastAPI via LlamaIndex to unblock event loops, allowing the handling of high concurrent requests (50+ users). - Security Enhancements: Integrated
slowapifor Rate Limiting and strictX-API-Keyheaders to protect endpoints from abuse, spam, and injection attempts. - Centralized Config: Adopted
pydantic-settingsto manage environments cleanly without violating the DRY principle.
- Advanced RAG Architecture: Uses a retrieve-then-rerank approach.
- High-Performance LLM: Powered by Llama 3 (via Groq API).
- Transparent Citations: Provides specific legal documents and page numbers.
- Dockerized: Fully containerized backend, frontend, and ChromaDB server.
- Robust API Layer: Centralized dependency injection, safe error handling, and robust Pydantic input validation.
- Core Framework: LlamaIndex
- LLM Provider: Groq
- Vector Database: ChromaDB Server
- Embedding Model: HuggingFace
- Backend: FastAPI, Pydantic Settings, SlowAPI
- Frontend: Streamlit
Legal-Chatbot/
├── backend/
│ └── app/
│ ├── config.py # Centralized Configuration
│ ├── api.py # API Endpoints & Security
│ ├── engine.py # RAG Logic
│ └── ingest.py # Data ETL
├── frontend/ # Streamlit User Interface
├── Data/ # Raw PDFs & Chroma DB Volumes
└── docker-compose.yml # Multi-container orchestration (App + Chroma)