Skip to content
← All articles

How I make CI fail when my chatbot's answers get worse

By Muhammad Umer Khan · Built Nov 2025 to Jul 2026
Published

AskUmer is a RAG assistant I built that answers questions about my work. Every push to its main branch runs a suite that asks it real questions, has a second model score each answer for faithfulness and relevancy, and fails the build if any answer scores below 0.7. Here is how that gate works, what a free tier forces on it, and the bug it could never have caught.

What the assistant does

It searches 898 indexed chunks two ways at once: Qdrant for meaning, with 768-dimension embeddings, and BM25 for exact words. Reciprocal Rank Fusion merges the two lists, and a FlashRank cross-encoder reranks them down to the best five. A LangGraph agent decides on every turn whether to search at all, so a follow-up the conversation already answers costs no database call.

Decide what worse means before you build

Two numbers define worse for this assistant. Faithfulness checks that every claim in an answer is supported by the context it retrieved, which is what catches a made-up answer. Answer relevancy checks that the answer addresses the question that was asked, not a nearby one. Each has to reach 0.7.

The suite runs in two phases. First it puts each test question to the running assistant and keeps the answer and the context it retrieved. Then DeepEval has a judge model score them. The script exits with 1 if any answer misses either threshold, and CI runs it on every push and pull request to main, so a change that makes answers worse fails the build instead of reaching anyone.

What a free tier does to an eval

The judge model runs on its own free-tier key, limited to 6,000 tokens a minute. A full run would blow through that, so the automated run scores one sample, and the full 15-question set runs by hand.

That changes what the gate means. It catches a broken pipeline and a large regression on the question it asks. It cannot see a subtle slide on the other fourteen. I would rather say that plainly than call one sample a test suite, and the honest fix is a paid judge key, not a lower bar.

Guardrails go before retrieval

NeMo Guardrails reads every question first and blocks jailbreaks, prompt injection and off-topic questions before any search or model call happens. Checking at the door is cheaper than checking an answer after it has been generated, and an injection that never reaches the model cannot steer it.

The bug no eval would have caught

A lighter build of AskUmer runs the chat on this site, searching these pages and my résumé. It was meant to read the site fresh every time it started. For more than a week it answered from an old copy instead, and still called one of my products by its old name. After fetching each page it tried to save a copy to a folder that is read-only where it is hosted, and that error was caught as if the fetch itself had failed.

A faithfulness score would have passed it. Faithfulness checks an answer against the context the assistant retrieved, and here the context itself was out of date. I fixed it on 8 November by keeping the fetched text whatever happens to the save, tested against a simulated read-only disk before it shipped. The lesson I took: test where you deploy, and check freshness, not only faithfulness.

Source: AskUmer on GitHub (opens in a new tab)Its CI workflow (opens in a new tab)

I build these for startups. AI MVP development

Free 30-minute build audit

Get in touch to start building yours.

Bring the idea or the workflow. In 30 minutes you get what I would build first and how I would prove it works. NDA before the first call.

calls 2pm to 11pm PKT · reply within 24h · WhatsApp +92 343 2187868