{"slug": "i-built-a-rag-assistant-that-explains-your-electricity-bill-without-letting-the", "title": "I Built a RAG Assistant That Explains Your Electricity Bill — Without Letting the AI Invent Numbers", "summary": "Malik Ali Hassan built BijliCheck, a framework-free web app hosted on Vercel that computes a Pakistani electricity bill first and then lets a RAG-based assistant answer plain-English questions using only the user's computed numbers and retrieved tariff facts, preventing the model from inventing rates. The assistant performs keyword matching over a local knowledge base in the browser rather than using a vector database, with a single serverless function calling Groq's free tier to keep the API key secret. Hassan reports the setup cost $0 and took about 15 minutes, and argues the compute-numbers-first, retrieve-rules-second pattern generalizes to any domain where the model must not invent figures.", "body_md": "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.\n\nI 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.\n\nThere are two halves, and the order matters.\n\n**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.\n\n**Second, the assistant.** It uses retrieval-augmented generation (RAG), in three steps:\n\nThe 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.\n\nThe 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.\n\nThere'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.\n\nThe whole thing is HTML and JavaScript — no framework — hosted on Vercel for free, connected directly to the GitHub repository. The one piece that isn't static is a single tiny serverless function in the `api/` folder. It exists for one reason: the API key has to stay secret, and a purely static host can't keep a secret. So the browser does the retrieval, and the serverless function makes the one call that needs the key.\n\nTotal 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.\n\nBijliCheck 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.\n\n*Malik Ali Hassan — .NET & full-stack developer, final-year Software Engineering student. I build Python automation, AI assistants, and web apps.*", "url": "https://wpnews.pro/news/i-built-a-rag-assistant-that-explains-your-electricity-bill-without-letting-the", "canonical_source": "https://dev.to/malikali777/i-built-a-rag-assistant-that-explains-your-electricity-bill-without-letting-the-ai-invent-numbers-5haf", "published_at": "2026-11-04 06:43:47+00:00", "updated_at": "2026-11-04 06:52:16.306282+00:00", "lang": "en", "topics": ["artificial-intelligence", "generative-ai", "ai-tools", "ai-agents"], "entities": ["Malik Ali Hassan", "BijliCheck", "Vercel", "GitHub", "Groq"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/i-built-a-rag-assistant-that-explains-your-electricity-bill-without-letting-the", "markdown": "https://wpnews.pro/news/i-built-a-rag-assistant-that-explains-your-electricity-bill-without-letting-the.md", "text": "https://wpnews.pro/news/i-built-a-rag-assistant-that-explains-your-electricity-bill-without-letting-the.txt", "jsonld": "https://wpnews.pro/news/i-built-a-rag-assistant-that-explains-your-electricity-bill-without-letting-the.jsonld"}}