Back to previous page

Personal project

Agentic RAG Assistant for Gas-Turbine Maintenance

Python · Claude API (Haiku 5.5, Sonnet 5.5) · FAISS · BM25 · Cross-encoder re-ranking · FastAPI · SQLite · scikit-learn · Docker · GitHub Actions · December 2026

Maintenance knowledge sits in handbooks, standards and sensor logs. A language model asked about them directly can give an answer that sounds right and is not. I built an assistant that answers from 14 public technical documents (FAA, DOE/NETL, EPA and NASA) and cites the page for every claim. It can also query NASA's C-MAPSS simulated engine telemetry and estimate the remaining useful life (RUL) of an engine with a model I trained myself. I picked that model on a Pareto front of model size against error. It is a gradient-boosting model with 50 trees of depth 2, and its test RMSE is 17.3 cycles. The language model itself is an unmodified Claude model called through the API, with no fine-tuning.

A guided tour of the project: the data, the agent, how it was evaluated and what came out (3 min 12 s, no voice). Music: original, synthesized for this video.

A question first goes through an out-of-domain check. If the best retrieval score is below a threshold, the assistant refuses without calling the model. Otherwise Claude runs a loop of at most six calls, with three tools: document search, engine telemetry from a SQLite database and the RUL estimate. Document search combines BM25 with dense vectors (bge-small and FAISS), merges both rankings with Reciprocal Rank Fusion and re-ranks the result with a cross-encoder. The documents are cut into 250-word chunks that keep their page number. Before an answer goes out, a second check verifies that every cited page belongs to a chunk retrieved in that run. If not, the answer becomes "I don't know". A FastAPI service exposes the assistant, Docker packages it, and GitHub Actions runs the linter, the tests and a retrieval check that needs no API calls.

Architecture diagram: a question passes the out-of-domain check, then a tool-calling loop with document search, engine telemetry and RUL estimate tools over a hybrid index, a SQLite database and a RUL model, then a citation check before the answer
The architecture. The orange boxes are the two checks, one before the model is called and one before the answer is returned.

To measure it, I used 97 questions: 30 easy and 30 hard questions on the documents, 14 on telemetry, 11 that the documents cannot answer and 12 outside the domain. Claude Haiku 5.5 or Claude Sonnet 5.5 answers each one, and a Claude Haiku 5.5 judge compares the answer with a reference. With the original out-of-domain filter (threshold −2.0), Haiku scored 89.4 % over 10 runs. Without the filter it scored 96.2 % over 3 runs. The filter was cutting 8 hard in-domain questions before the model ever saw them. Sonnet 5.5 without the filter scored 99.3 % over 3 runs, at about 16 times the cost per run (1.293 USD against 0.080 USD).

Overall accuracy with a 95 % interval: Haiku with the −2.0 filter 89.4 %, Haiku with the −4.0 filter 93.8 %, Haiku without the filter 96.2 %, Sonnet without the filter 99.3 %
Overall accuracy on the 97 questions. The −4.0 point is a single run, so its interval is a Wilson interval.

To see what other thresholds would have done, I replayed the saved runs with different values. This is an exploration on the evaluation set, not a calibration, because the 8 cut questions belong to that set. Between −3.0 and −4.95 the same 3 questions are cut, so I moved the default to −4.0 as an interim value. One confirmation run there scored 93.8 %.

Four panels against the filter threshold for Haiku and Sonnet: overall accuracy, hard-document accuracy, false refusals and out-of-domain refusals
Accuracy, false refusals and out-of-domain refusals as the threshold moves from −1 to off, computed from the saved runs without the filter.

Out-of-domain questions were refused 100 % of the time in every condition, and the telemetry and unanswerable questions were all handled correctly. The gap between Haiku and Sonnet is 3.1 points (paired bootstrap interval +0.7 to +6.2), but the exact McNemar test gives p = 0.5, so I do not treat the gap as established. To check the judge, an independent judge from another model family (gpt-5.4-mini) graded one run of each series again. It agreed with the Haiku judge on 97 % to 99 % of the answers both graded.

Cost of one evaluation run in USD on a log scale against overall accuracy for the four conditions
Cost of one run (agent plus judge) against accuracy. Sonnet sits far to the right on the log scale.

These are the limits I know about.

  • C-MAPSS is simulated turbofan data, not data from industrial gas turbines, and the RUL model covers only one of its four subsets (FD001).
  • The evaluation set is small. The 97 questions were drafted with AI help while the project was built, and differences of a few points are within noise.
  • The judges are language models. The main one is from the same family as one of the models it grades, and the independent judge checked only one run per series.
  • The threshold has not been calibrated on a separate set of questions. Sonnet has 3 runs and the confirmation at −4.0 has 1.
  • The citation check shows that a cited chunk was retrieved, not that it supports the claim.
  • It is a personal project. It was never deployed or used by anyone, and its outputs should not decide real maintenance.