[{"data":1,"prerenderedAt":226},["ShallowReactive",2],{"blog-hallucinations-regex":3},{"id":4,"title":5,"author":6,"body":7,"cover":208,"date":209,"description":210,"draft":211,"extension":212,"featured":213,"meta":214,"navigation":213,"ogImage":215,"path":216,"readingTime":215,"seo":217,"sitemap":218,"stem":219,"tags":220,"__hash__":225},"blog\u002Fblog\u002Fhallucinations-regex.md","How We Solved AI Hallucinations in Chatbots (The Simple Way)","Samuel Vrablik",{"type":8,"value":9,"toc":193},"minimark",[10,18,23,26,29,32,35,39,42,70,73,77,84,87,92,95,99,113,117,120,124,127,144,148,151,165,169,175,178,181],[11,12,13,17],"p",{},[14,15,16],"strong",{},"TLDR:"," We fixed AI hallucinations in our chatbots using simple regex\nvalidation after sophisticated LLM tweaking didn't work. Sometimes the\nold-school approach is the best approach.",[19,20,22],"h2",{"id":21},"the-problem","The Problem",[11,24,25],{},"On Chatisto, you can train ai agents from your website content - your products,\narticles, documentation, whatever you've got. It works pretty well most of the\ntime.",[11,27,28],{},"But here's what kept happening: in a small percentage of cases, the AI would\njust decide to generate completely new products that weren't in the knowledge\nbase. This usually happened when customers asked for specific product\nrecommendations and the model couldn't find anything it liked in the actual\ncatalog.",[11,30,31],{},"So instead of saying \"sorry, we don't have exactly what you're looking for,\" it\nwould confidently recommend \"The Perfect Winter Jacket - Model XZ-2024\" with a\nlink that led straight to a 404 page.",[11,33,34],{},"As a business owner, you could take this as market research for new products to\nintroduce. But you definitely don't want your customers landing on broken links.",[19,36,38],{"id":37},"what-i-tried-first","What I Tried First",[11,40,41],{},"I threw everything I could think of at this problem:",[43,44,45,52,58,64],"ul",{},[46,47,48,51],"li",{},[14,49,50],{},"Temperature adjustments:"," Made the AI more conservative",[46,53,54,57],{},[14,55,56],{},"System prompt engineering:"," Rewrote instructions multiple ways",[46,59,60,63],{},[14,61,62],{},"Better search algorithms:"," Improved content retrieval",[46,65,66,69],{},[14,67,68],{},"More prompt refinements:"," Because why not try again?",[11,71,72],{},"Despite all the fancy LLM settings and sophisticated prompting techniques, the\nhallucinations kept happening. Sometimes AI just wants to be helpful to the\npoint of making stuff up.",[19,74,76],{"id":75},"the-solution-that-actually-worked","The Solution That Actually Worked",[11,78,79,80,83],{},"When the sophisticated approaches failed, I went with something embarrassingly\nsimple: ",[14,81,82],{},"regex-based link validation",".",[11,85,86],{},"Here's how it works:",[88,89,91],"h3",{"id":90},"allowed-domains-url-patterns","Allowed Domains & URL Patterns",[11,93,94],{},"You configure exactly which domains and URL patterns your chatbot can link to.\nYour main store, specific product categories, particular landing pages -\nwhatever you want to allow.",[88,96,98],{"id":97},"filtering-options","Filtering Options",[43,100,101,107],{},[46,102,103,106],{},[14,104,105],{},"Link-only filtering:"," Removes just the bad links, keeps the text",[46,108,109,112],{},[14,110,111],{},"Sentence-level filtering:"," Removes entire sentences containing invalid\nlinks",[88,114,116],{"id":115},"pattern-matching","Pattern Matching",[11,118,119],{},"Old-school regex matching against your allowed patterns. If a link doesn't\nmatch, it gets filtered based on your settings.",[19,121,123],{"id":122},"why-this-works","Why This Works",[11,125,126],{},"The beauty is in the simplicity:",[43,128,129,132,135,138,141],{},[46,130,131],{},"No more 404 pages from chatbot recommendations",[46,133,134],{},"You maintain complete control over where customers get directed",[46,136,137],{},"Easy to configure and understand",[46,139,140],{},"Works regardless of how creative the AI gets",[46,142,143],{},"Customers actually find what was recommended to them",[19,145,147],{"id":146},"real-results","Real Results",[11,149,150],{},"Since implementing this:",[43,152,153,156,159,162],{},[46,154,155],{},"Zero customer complaints about broken product links",[46,157,158],{},"Business owners can trust their AI representatives",[46,160,161],{},"Better conversion rates because recommendations actually work",[46,163,164],{},"No more embarrassing \"this product doesn't exist\" moments",[19,166,168],{"id":167},"whats-next","What's Next",[11,170,171,172],{},"This regex approach is working well, but I'm curious - ",[14,173,174],{},"do you have other\nsolutions for this problem?",[11,176,177],{},"I'd love to hear how others are tackling AI hallucinations in customer service.\nThe simple approaches often work best, but maybe there's something I'm missing.",[179,180],"hr",{},[11,182,183,186,187,192],{},[14,184,185],{},"Dealing with similar issues?"," Check out our\n",[188,189,191],"a",{"href":190},"\u002Ffeatures\u002Fai-agents","AI Chatbot features"," to see how link validation can keep\nyour customers from hitting dead ends.",{"title":194,"searchDepth":195,"depth":195,"links":196},"",2,[197,198,199,205,206,207],{"id":21,"depth":195,"text":22},{"id":37,"depth":195,"text":38},{"id":75,"depth":195,"text":76,"children":200},[201,203,204],{"id":90,"depth":202,"text":91},3,{"id":97,"depth":202,"text":98},{"id":115,"depth":202,"text":116},{"id":122,"depth":195,"text":123},{"id":146,"depth":195,"text":147},{"id":167,"depth":195,"text":168},"\u002Fcovers\u002Frandom-2.webp","2025-07-25","AI chatbots sometimes recommend products that don't exist. Here's how we fixed this problem with a straightforward regex-based solution after fancy approaches didn't work.",false,"md",true,{},null,"\u002Fblog\u002Fhallucinations-regex",{"title":5,"description":210},{"loc":216},"blog\u002Fhallucinations-regex",[221,222,223,224],"ai chatbots","product update","hallucinations","customer experience","gH5c72g-EbPv8iwUhcoCOSgJIhZ_Ljmrdgm2-zl78OM",1793372702521]