AI checking service connected to LMS / 2026 / In progress
LMS AI Core.
The service that checks an AI answer against the lesson, claim by claim, before a learner sees it
Part of the LMS journey- Role
- AI and server engineering
- Built with
- Python · FastAPI · Pydantic · PHP · Laravel · PostgreSQL · pgvector
01What I built
The problem.
A passage on the right topic does not prove that an AI answer is right. The passage can match the question but disagree with a number, a date or a name in the answer. A study guide can also be good and still out of date, because the lesson changed after the guide was made.
What I built.
LMS AI Core is the AI half of LMS. First, the Laravel side of LMS checks that the learner may see the lesson. It gathers passages from the lesson and asks the AI provider for an answer. The Python service then ranks the passages, best match first. It checks the answer one claim at a time, where a claim is a single statement. Laravel reads the result and decides what to show.
The AI service
Python, FastAPI, Pydantic
- Passage ranking
- Puts the passages Laravel sends in order, best match first. It looks at matching phrases and keywords. It also looks at each passage’s title and source.The storyMoving AI checks to Python while Laravel keeps learner access
- Claim checking
- Splits an answer into claims, which are single statements, and checks that the lesson supports each one. It also spots clashes in numbers, dates and names. And it spots clashes in quotes, in the order of things, and where one side says “not”.The storiesMoving AI checks to Python while Laravel keeps learner accessChecking each claim in an AI answer against the lesson
- Key-only access
- Every request to the service’s main web addresses, the ones with a version number, must carry an access key. If no key has been set up, the service refuses the request. Its public documentation pages are switched off.The storyProtecting learner text in saved conversations and evaluation reports
The Laravel side
Laravel, PostgreSQL, pgvector
- Lesson sources
- Each lesson is saved as a source with a version number, split into small chunks of text. Each chunk gets a fingerprint, a short code that changes when its content changes. Searches look only inside the learner’s own courses.The storiesRebuilding lesson sources from repaired transcriptsKeeping AI answers tied to the lesson sources
- Gateway and fallback
- In live mode, Laravel uses the result from the Python service. If the service is too slow or fails, Laravel switches to its own local check. So nothing goes out unchecked.The storyChecking AI answers in Python, with a local check as backup
- Study guides
- A saved guide is shown only while it still matches the lesson as it is now. It must also match the current AI provider, model and settings.The storiesWhy the study guide worker wouldn’t startWhy a ready study guide looked unavailable
- Privacy
- Logs and saved conversations blank out private text. Evaluation exports, the files used to judge answer quality, keep summaries instead of full answers.The storyProtecting learner text in saved conversations and evaluation reports
02The journey
What broke, and what changed.
Broke, then fixedA decisionA milestone
- 01 of 10Decided
Give the checking its own service, keep access in Laravel
The questionThe checks could live inside Laravel or in a separate service.
What I choseThe Python service gets a narrow job. It ranks the passagesLMS AI Core · The AI servicePassage rankingPuts the passages Laravel sends in order, best match first. It looks at matching phrases and keywords. It also looks at each passage’s title and source.See it in the map above it is given and checks claimsLMS AI Core · The AI serviceClaim checkingSplits an answer into claims, which are single statements, and checks that the lesson supports each one. It also spots clashes in numbers, dates and names. And it spots clashes in quotes, in the order of things, and where one side says “not”.See it in the map above. Laravel keeps enrolment and storage. It also makes the calls to the AI provider and decides the final answer. The service can be tested on its own, and it has no power to give a learner access.
- 02 of 10Decided
Check the claims, not just the search results
The questionA passage that ranked well was treated as support for everything in the answer.
What I choseRankingLMS AI Core · The AI servicePassage rankingPuts the passages Laravel sends in order, best match first. It looks at matching phrases and keywords. It also looks at each passage’s title and source.See it in the map above and checking are now separate steps. The checkerLMS AI Core · The AI serviceClaim checkingSplits an answer into claims, which are single statements, and checks that the lesson supports each one. It also spots clashes in numbers, dates and names. And it spots clashes in quotes, in the order of things, and where one side says “not”.See it in the map above reports which passages support each claim. Laravel then trims the answer, or offers suggestions for what to review instead.
- 03 of 10Decided
Never let a service failure mean an unchecked answer
The questionA new service is one more thing that can fail.
What I choseThe local checkLMS AI Core · The Laravel sideGateway and fallbackIn live mode, Laravel uses the result from the Python service. If the service is too slow or fails, Laravel switches to its own local check. So nothing goes out unchecked.See it in the map above inside Laravel stays. In shadow mode, both checks run and their results are compared, without changing the answer. If the service is too slow or fails, Laravel falls back to the local check.
- 04 of 10Broke
The background worker would not start
What went wrongThe worker is a program that keeps running and works through queues of background jobs. On the test site, it kept failing because its start command used an option Laravel does not support. The script that puts new code on the site still finished, so nothing warned anyone.
What changedThe worker’s start command now uses checked queue names, checked numbers and supported options. The one-off job that clears the old waiting jobs stays separate.
ProofThe recorded test for this bug covers both files that put the code on the site, with 79 checks.
Read the full story - 05 of 10Broke
A finished study guide showed as unavailable
What went wrongThe learner page followed an older failed attempt, even though a good, current guideLMS AI Core · The Laravel sideStudy guidesA saved guide is shown only while it still matches the lesson as it is now. It must also match the current AI provider, model and settings.See it in the map above was already saved. The admin filter then disagreed with the page.
What changedThe page now looks first for a saved guide that still matches the lesson. The guide must also match the current AI provider, model and rules. The admin filter now reads the same worked-out status.
ProofThe record shows eight checks passing in the test for whether a guide is ready, then 87 in the admin tests.
Read the full story - 06 of 10Broke
A repaired transcript was ignored
What went wrongA transcriptLMS AI Core · The Laravel sideLesson sourcesEach lesson is saved as a source with a version number, split into small chunks of text. Each chunk gets a fingerprint, a short code that changes when its content changes. Searches look only inside the learner’s own courses.See it in the map above is the written text of a lesson’s video or file. When a lesson was rebuilt, the LMS set up a fresh import of its transcript. It did this before checking whether an admin had already fixed the transcript by hand. Fixing that showed two more cases. One was a source marked ready but with no text. The other was text still attached to a video that had been replaced.
What changedA rebuild now checks for usable text first and refuses empty sources. It also checks each transcript against the current video or file. Study guidesLMS AI Core · The Laravel sideStudy guidesA saved guide is shown only while it still matches the lesson as it is now. It must also match the current AI provider, model and settings.See it in the map above and the AI assistant skip material that is out of date.
ProofEach fix started with a test that showed the bug. Afterwards, six, three and four checks passed across the three cases.
Read the full story - 07 of 10Broke
The service answered without an access key
What went wrongWith no access keyLMS AI Core · The AI serviceKey-only accessEvery request to the service’s main web addresses, the ones with a version number, must carry an access key. If no key has been set up, the service refuses the request. Its public documentation pages are switched off.See it in the map above set up, the service still accepted requests. Its A technical wordAPIA set of web addresses that one program uses to ask another program for data, or to ask it to do something. documentation, the pages that list the web addresses other programs can call, was public too. Saved conversations and evaluation exportsLMS AI Core · The Laravel sidePrivacyLogs and saved conversations blank out private text. Evaluation exports, the files used to judge answer quality, keep summaries instead of full answers.See it in the map above also kept private text that the query log had already blanked out.
What changedNow, with no access key set up, every request is refused. The documentation pages are off. Saved messages are blanked out in the same way, and the exports keep summaries.
ProofThe recorded run had 12 Python tests, and 54 Laravel tests written in A technical wordPHPThe programming language that Laravel, a popular web framework, is written in., the language Laravel uses, with 360 checks.
Read the full story - 08 of 10Broke
Rebuilding unchanged text made a good guide look out of date
What went wrongEach guideLMS AI Core · The Laravel sideStudy guidesA saved guide is shown only while it still matches the lesson as it is now. It must also match the current AI provider, model and settings.See it in the map above has a fingerprint, a short code that changes when the lesson changes. It shows whether the guide is still up to date. The fingerprint included the IDs of database rows. Rebuilding the same lesson text created new rows, so the fingerprint changed.
What changedThe fingerprint is now built from the content itself. It uses the source’s type and key, and a fingerprint of the content. It also uses each piece’s position, its times and the text that was picked.
ProofThe test for this bug rebuilds the rows from the same material. It expects exactly the same fingerprint.
- 09 of 10Broke
One bad quiz question hid a whole study guide
What went wrongA study guideLMS AI Core · The Laravel sideStudy guidesA saved guide is shown only while it still matches the lesson as it is now. It must also match the current AI provider, model and settings.See it in the map above and its practice questions passed or failed as one. A single unsupported answer hid lesson points that had passed their own checks.
What changedPractice questions are now optional. Unsupported questions are dropped, and the checked guide still shows.
ProofThe test for this bug gives a supported guide with one unsupported question. It expects the guide to show, with no questions.
- 10 of 10Decided
Let AI word a recommendation, not choose where it leads
The questionRecommendations need friendly wording. But the AI model should not decide where a learner is sent.
What I choseLaravel first picks what to recommend, and in what order. The AI model only writes the wording. Laravel puts each piece of wording back by its place in the list.
03Today
Where it stands.
RankingLMS AI Core · The AI servicePassage rankingPuts the passages Laravel sends in order, best match first. It looks at matching phrases and keywords. It also looks at each passage’s title and source.See it in the map above and claim checking use scored text rules, not an AI model. They catch conflicts and missing support, but they do not prove that an answer is right. In shadow mode, where both checks run and are compared, each request has to wait for the Python service. The Python side still expects a quiz of a minimum size, unlike Laravel.