Case study

A RAG-based AI assistant for an e-learning platform.

Clait built a RAG-based AI assistant for a Moodle e-learning platform: it reads and indexes the courses’ PDF documents and answers learners’ questions only from the courses they are enrolled in, citing document and page.

Published

01

The context

Learners on a Moodle-based e-learning platform look for answers about their course content. The goal: an assistant built into the platform that answers from the materials of the courses each learner is enrolled in, always showing its sources.

02

From documents to knowledge

  1. Selection

    The PDFs of visible courses enabled for the assistant are indexed.

  2. Structured reading

    Text is extracted page by page, keeping section headings, page and lesson.

  3. Language and summary

    Each document’s language is detected and a summary is generated, used when search finds no precise enough passage.

  4. Semantic chunking

    Text is split into passages that hold together by meaning, not by fixed length.

03

Search and answer

  1. Hybrid search

    Semantic and keyword (BM25) search combined, limited to the learner’s courses.

  2. Reranking

    A multilingual reranking model reorders the candidates; the top three passages reach the model.

  3. Grounded answers

    The model answers only from the retrieved context; if the answer is not there, it says so.

  4. Citations

    Every answer shows document, page and a link to the course.

  5. Structured data

    Questions about events, progress and certificates are answered by predefined queries on the platform’s database, not written by an LLM.

  6. Multilingual

    It answers in the language of the question and says when content exists only in another language.

04

Security and control

  1. Access

    The assistant checks the user’s session on the platform and retrieves only content from their courses.

  2. Guardrails

    It blocks attempts to extract its instructions, requests for exam answers and questions about other users’ data.

  3. Safe links

    A filter strips any unauthorised link from answers.

  4. Privacy

    User identifiers in analytics are pseudonymised and stored text is deleted after 90 days.

05

For the platform’s administrators

The chat widget, built into Moodle, streams answers with their sources and asks for a 1–5 star rating. A back office brings together conversations, answer quality, content coverage, usage and costs, with tools for handling GDPR requests.

06

Technology

Backend
Python, FastAPI, LangChain
Search
Qdrant (vectors + BM25), jina-reranker-v2-base-multilingual reranker
Models
Azure OpenAI: text-embedding-3-small, GPT-5 mini, GPT-5 nano
Documents
PyMuPDF, langdetect
Frontend
Vue 3 widget built into Moodle
Infrastructure
Docker, MariaDB, Prometheus, Grafana, Loki

FAQ

Frequently asked questions.

Can the assistant make answers up?

It is instructed to answer only from the context retrieved from the course documents; when that context is not enough, it says it does not know.

Can a learner see content from courses they are not enrolled in?

No: search is filtered to the courses the user is enrolled in.

Which languages does it answer in?

The language of the question; when content exists only in another language, it says so.

Contact

We find a solution for everyone.
We'll find yours too.

Tell us what you'd like to improve, even if for now it's only an idea. We'll start from there and build the rest together.

Your data will be processed as described in our privacy policy.