Skip to content

Commit ec11650

Browse files
committed
2 parents b94596b + f417261 commit ec11650

1 file changed

Lines changed: 41 additions & 112 deletions

File tree

README.md

Lines changed: 41 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,59 @@
1-
# Chatbot Backend
1+
# Learning module with conversational educational system - Backend Module
22

3-
Educational chatbot with Moodle integration and RAG capabilities.
3+
This repository contains the Backend Module developed as the primary functional layer for the Bachelor's Engineering Thesis: **"Learning module with conversational educational system"**.
44

5-
## Project Structure
5+
---
66

7-
```
8-
chatbot-backend/
9-
├── app/ # Main application
10-
│ ├── __init__.py
11-
│ ├── main.py # FastAPI app setup
12-
│ ├── api/
13-
│ │ └── routes/ # API endpoints
14-
│ │ ├── chat.py # Chat endpoints
15-
│ │ ├── moodle.py # Moodle integration
16-
│ │ ├── embeddings.py # Embedding generation
17-
│ │ └── health.py # Health checks
18-
│ ├── services/ # Business logic
19-
│ │ ├── llm_service.py # LLM integration (Ollama)
20-
│ │ ├── moodle_service.py
21-
│ │ ├── embedding_service.py # Embedding generation
22-
│ │ └── rag_service.py # RAG
23-
│ ├── models/ # Data models
24-
│ │ ├── schemas.py # Pydantic schemas
25-
│ │ └── database.py # SQLAlchemy models
26-
│ ├── core/
27-
│ │ └── database.py # DB connection
28-
│ └── config/ # Configuration
29-
│ └── settings.py
30-
├── docker-compose.yaml
31-
├── Dockerfile # Backend container
32-
├── Dockerfile.ollama # Ollama container
33-
├── requirements.txt
34-
└── README.md
35-
```
7+
## Academic Context
8+
* **University:** Warsaw University of Technology (Politechnika Warszawska)
9+
* **Faculty:** Faculty of Mathematics and Information Science (MiNI)
10+
* **Supervisor:** dr inż. Anna Wróblewska
11+
* **Authors:** Anna Ostrowska, Gabriela Majstrak, Jan Opala
3612

37-
## Setup
13+
---
3814

39-
### Prerequisites
15+
## Technical Stack & Architecture
16+
The backend is built as a high-performance REST API using **FastAPI**, designed to utilize the RAG (Retrieval-Augmented Generation) pipeline.
4017

41-
- Docker Desktop
42-
- Python 3.10+ (for local development)
43-
- 8GB+ RAM recommended
18+
### Core Technologies:
19+
* **Vector Database:** ChromaDB for efficient semantic search and context retrieval.
20+
* **OCR & Parsing:** Adaptive document processing.
21+
* **LLM Orchestration:** Integration with **OpenAI (GPT-4o-mini)** and **Google Gemini** for generation, and **Voyage AI** for embeddings.
22+
* **Task Scheduling:** **APScheduler** automatically synchronizes course materials from Moodle.
4423

45-
### Environment Variables
24+
---
4625

47-
Create a `.env` file:
26+
## Key Features
4827

49-
```env
50-
# LLM Settings
51-
LLM_BASE_URL=http://ollama:11434
52-
CHAT_MODEL=
53-
EMBED_MODEL=
54-
LLM_TIMEOUT=
55-
MAX_TOKENS=
56-
TEMPERATURE=
28+
### 1. Advanced Document Ingestion
29+
The system features a custom-built ingestion pipeline (`parser_utils.py`) that includes:
30+
* **Adaptive OCR**
31+
* **Context-Aware Chunking**
32+
* **Math Normalization**
5733

58-
# Moodle Settings
59-
MOODLE_BASE_URL=
34+
### 2. Intelligent Services
35+
* **RAG Pipeline:** Uses vector search to provide factually grounded answers strictly based on course content.
36+
* **Quiz Generation:** Automated assessment creation based on Bloom's Taxonomy to evaluate student understanding.
37+
* **Smart Sync:** Periodic background jobs that check for new course materials without manual teacher intervention.
6038

61-
# Database
62-
DATABASE_URL=
39+
---
6340

64-
# CORS
65-
CORS_ORIGINS=["http://localhost:3000","https://moodle-edu-chatbot.vercel.app"]
66-
```
41+
## Repository Structure
42+
* **`app/api/routes/`**: Define API endpoints for chat, quiz, and dashboard features.
43+
* **`app/services/`**: Core business logic, including the RAG engine and embedding management.
44+
* **`app/core/parser_utils.py`**: Technical implementation of the parsing and OCR logic.
45+
* **`Dockerfile` & `docker-compose.yaml`**: Full containerization setup for easy deployment and scalability.
6746

68-
### Docker Deployment
47+
---
6948

70-
```powershell
71-
# Build and start all services
49+
## Deployment (Docker)
50+
1. Ensure your `.env` file is configured with the necessary API keys.
51+
2. Build and start the system:
52+
```bash
7253
docker compose up -d --build
73-
74-
# Check logs
75-
docker compose logs -f
76-
77-
# Stop services
78-
docker compose down
79-
```
80-
81-
## API Endpoints
82-
83-
### Chat
84-
85-
**POST** `/chat`
86-
87-
```json
88-
{
89-
"message": "Hello!",
90-
"history": [
91-
{"role": "user", "content": "Previous message"},
92-
{"role": "assistant", "content": "Previous response"}
93-
],
94-
"stream": false
95-
}
9654
```
55+
The API will be available at http://localhost:8000 with interactive Swagger documentation at /docs.
9756

98-
### Embeddings
99-
100-
**POST** `/api/embeddings?text=your_text`
101-
102-
Returns vector embedding with dimensions.
103-
104-
### Moodle
105-
106-
**POST** `/api/moodle/login`
107-
108-
```json
109-
{
110-
"username": "user",
111-
"password": "pass"
112-
}
113-
```
114-
115-
**GET** `/api/moodle/courses?token=YOUR_TOKEN`
116-
117-
**GET** `/api/moodle/assignments?token=YOUR_TOKEN&course_id=1`
118-
119-
### Health
120-
121-
**GET** `/health` - Returns `{"status": "ok"}`
122-
123-
124-
## Configuration
125-
126-
All configuration is in `app/config/settings.py`. Override via:
57+
---
12758

128-
1. `.env` file
129-
2. Environment variables
130-
3. Defaults in Settings class
59+
*Developed as the primary technical part of the diploma process at Warsaw University of Technology.*

0 commit comments

Comments
 (0)