How rwth-acis/lms-chatbot-service works
Project Type and Purpose
• This is a specialized backend “LMS-chatbot service” (MoodleBot) that uses generative AI frameworks (LangChain, LLamaIndex) to answer student questions and act as a tutor. It integrates with an external Social Bot Framework and a Moodle instance, and persists data to Weaviate (vector DB) and MongoDB.
File Structure Analysis
• Top-level entrypoints:
• app.py – service bootstrap / HTTP or messaging endpoint
• agents.py, questionGenerator.py, factchecker.py – encapsulate different LangChain agent behaviors
• indexRetriever.py, weaviateRetriever.py – document retrieval logic
• bot/…Model.json – pre-trained or fine-tuned chatbot model definitions
• Config & deployment:
• Dockerfile, docker-compose.yaml, .github/workflows/docker-CI.yml – containerization & CI
• requirements.txt – Python dependencies (LangChain, LLamaIndex, weaviate-client, OpenAI SDK)
• Tests under tests/ validate ingestion, PDF handling, prompts, etc.
Key README Insights
• Core tech stack: OpenAI API, LLamaIndex, LangChain, Weaviate, MongoDB
• External integrations: Social Bot Framework, tech4comp Moodle
• Environment variables drive endpoints for Weaviate, Mongo, credentials, selected file paths
Main Components
A. User Interface Layer
• Social Bot Framework → MoodleBot service (app.py)
B. API / Orchestration Layer
• app.py routes incoming requests to appropriate agent in agents.py
C. Retrieval Layer
• indexRetriever.py / weaviateRetriever.py → query Weaviate vector store
D. Indexing and Vector Store
• Weaviate cluster (Vector DB)
E. LLM Agent Layer
• LangChain / LLamaIndex agents (agents.py, questionGenerator.py, factchecker.py) calling OpenAI API
F. Persistence Layer
• MongoDB (chat history collection)
• Optional: local file paths or slide ingestion logic
G. Infrastructure / DevOps
• Docker containers (service, weaviate, mongo) orchestrated by docker-compose
• CI pipeline (.github/workflows)
Relationships and Data Flows
1. User → Social Bot Framework → HTTP/gRPC → MoodleBot app
2. app.py → Routing → Retrieval Layer → Weaviate
3. Retrieved docs → Agent Layer → OpenAI API → Agent response
4. Agent response → app.py → Social Bot Framework → User
5. app.py logs request/response → MongoDB
• During ingestion: File system (slides, PDFs) → indexRetriever → Weaviate ingestion
Architectural Patterns and Principles
• Modular “plugin” pattern for different agents (tutor, fact-checker, question generator)
• Separation of concerns: retrieval vs. generative logic vs. persistence vs. integration
• Containerized microservices (each component in docker-compose)
• Use of environment variables for external service endpoints and credentials
Essential Elements
• Clear component labels (e.g., “app.py (FastAPI/Gunicorn)”)