ai newsMi., 4. Nov.

I Built a RAG Assistant That Explains Your Electricity Bill — Without Letting the AI Invent Numbers

Pakistani electricity bills are hard to read even when you're technical. The total jumps month to month, and the bill itself doesn't really explain why — slabs, categories, rates, and surcharges all blur together. Most people just pay it and move on. I built BijliCheck at a hackathon to attack that

dev.toMittwoch 07:43 · 04.11.3 Min. Lesezeit
Bild: dev.to

Pakistani electricity bills are hard to read even when you're technical. The total jumps month to month, and the bill itself doesn't really explain why — slabs, categories, rates, and surcharges all blur together. Most people just pay it and move on.

I built BijliCheck at a hackathon to attack that confusion directly: a Bill Checker web app with an "Ask about your bill" AI assistant box. You check your bill, then you ask it questions about it in plain English — "why did my bill jump so much?", "how do I avoid this next time?" — and it answers using your actual numbers, not generic advice.

There are two halves, and the order matters.

First, the Bill Checker. You open the site, fill in your usage, and click "Check my bill." That produces your computed bill numbers: units, category, rate, and total. Nothing about the assistant works without this step, because the assistant's job is to explain these numbers — not to guess at bills in general.

Second, the assistant. It uses retrieval-augmented generation (RAG), in three steps:

The user sees the retrieved reference facts listed first, then the generated answer. That ordering is deliberate: you can see what the answer is based on before you read the answer itself.

The assistant is not allowed to invent tariff numbers that were not given to it. That's the whole point of the RAG setup here. A plain chatbot asked about electricity bills will happily produce confident-sounding rates that may be wrong — and a wrong number on a bill is worse than no answer at all. By forcing every answer through retrieved facts plus the user's own computed numbers, the system trades fluency for grounding. The answer might be less smooth than a free-form chat, but it can't hallucinate a slab rate.

There's a second, quieter lesson in the retrieval step: RAG doesn't have to mean a vector database. For a small, well-understood set of facts — slab rules and billing facts — keyword matching over a local knowledge base is fast, free, and runs entirely in the browser. The fancy version of a technique is not always the right version. Match the retrieval method to the size of your knowledge base.

Total setup cost: $0, on Groq's free tier, in about 15 minutes. If the Ask box ever says "offline mode," it means that serverless endpoint isn't reachable — usually the API key wasn't set or the deployment wasn't redeployed after adding it. That's a deployment detail, but it's the kind of thing that eats an hour at a hackathon if you don't know where to look.

BijliCheck started as a hackathon demo, but the pattern generalises: any domain where the model must not invent numbers — bills, tariffs, schedules, policies — benefits from the same shape. Compute the real numbers first, retrieve the real rules, and only then let the model talk.

Malik Ali Hassan —.NET & full-stack developer, final-year Software Engineering student. I build Python automation, AI assistants, and web apps.

Quelle: dev.to (dev.to). Original öffnen