Forward deployment: a chatbot for a multinational's site search
In 2024 and 2025, I deployed a chatbot to consolidate a multinational's website search into one place to ask. The model and the retrieval belonged to a vendor, so I couldn't change either one. I worked on what sat around them instead: prompt engineering, a link filter and testing.
The vendor's platform held everything except the instructions
The site had hundreds of pages across three domains, covering articles, case studies, services and careers. Before the chatbot, finding an answer meant digging through menus across three domains or guessing the right keywords for a basic search. The chatbot was intended to replace that with one place to ask. It would consolidate all three domains into one answer, linking the pages most relevant to the question.
The bot ran on a vendor's retrieval-augmented generation (RAG) platform, which searched the site's pages and had an LLM answer from them. Our code only passed each conversation to the platform and back. That kept our code small, but it left the model and the retrieval inside the vendor's platform.
Prompt engineering fixed most failures, but not hallucinated links
Once live, the bot failed in ways we couldn't fix in the model or the retrieval, because both belonged to the vendor. The vendor's guidance was to fix them with instructions, so prompt engineering became my main tool. I versioned the instructions and changed them only in response to a failure seen in real conversations. The search instructions went through four versions in about three weeks.
These failures were persistent. A fix that worked in one conversation often broke in the next, so each one took several rounds:
- One-word queries got no answer. Visitors often typed a single word, such as "cloud", the way they would in a search box. The bot treated these as incomplete questions and replied with nothing useful. Each instruction I added helped some words and missed others, until a version treating any single word as a topic held.
- The bot talked about the client as an outsider. Its answers said "they" when describing the client's services, as if a third party were writing. A pronoun rule alone kept slipping. What held was giving the bot a fuller employee story, so it saw itself as part of the company rather than following an instruction about wording.
- Off-topic questions got deflected, but the boundary kept leaking. Six instructions told the bot to deflect any question that wasn't about the company's work, services or careers. Defining scope as "anything else" left too much room, so questions slipped through. I switched to naming what was out of scope explicitly, as a list I kept managing as new cases appeared.
Prompt engineering eventually fixed these three issues. One failure kept coming back, whatever the instructions said.
That failure was hallucinated links. In the chat logs, I found the platform's retrieval picked the right pages, but the model rewrote their links. It swapped segments between real URLs, so the links looked plausible and led to 404 pages. At the worst point, about 14% of links in answers were broken this way. More instructions made hallucinated links rarer, but fewer still meant broken links on a multinational's site.
The bot already had an instruction to copy its URLs exactly, and it broke that instruction anyway. I explained to the client that an instruction is just more text in the model's context. It shifts the odds of what the model writes, but it can't block an output.
Layered controls, starting with a link filter
Since no wording could guarantee the behaviour, I proposed layers of control, each catching what the one before missed:
- instructions, for most cases;
- a blocklist of known out-of-scope topics;
- stress tests, to find new failures before visitors did;
- a moderation layer in code, for anything that had to hold every time.
Links were the first problem for the moderation layer. Before committing to building it, I ran discovery. I rated seven alternative chatbot platforms against our requirements, and weighed each approach by what it would fix and what the client would have to maintain. That left three options:
- Switch vendor. The best of the seven scored 84% on our weighted requirements, but switching meant rebuilding the integration to fix one problem.
- Build our own wrapper around a model API. Full control, but we'd be running it alongside the vendor's platform.
- Add a filter that checks every link before the visitor sees it.
We chose the filter because it preserved what already worked. The vendor's platform stayed in place, and the filter ran on the client's own servers. Each answer also stayed intact: instead of deleting a bad link, the filter redirected the visitor somewhere useful.
The filter launched in February 2025. I wrote about half its spec, mostly the cases below, and the engineers built it.
The filter works in two steps:
- Every night, it reads the site's sitemap, the file that lists every published page, and keeps that list in memory.
- It checks each link in each answer against the list and handles it as one of five cases, each keeping the visitor as close as possible to what they were looking for.
| Link in the answer | What the visitor receives |
|---|---|
| A published page | The same link |
A hallucinated link whose parent page exists, such as /work/unknown-case | The parent page, /work |
| A hallucinated link with no usable parent | A site search for the link's last segment, such as /search?q=supply+chain |
| A page on another website | The same link |
| A document on the site, such as a PDF | The same link |
I had the filter fail open: if the sitemap failed to load or the filter errored, the visitor got the original answer. I preferred an occasional bad link to a bot that stopped answering. I turned unfixable links into searches because each one still named what the visitor wanted. A search for "supply chain" gave them a next step instead of a 404.
With the filter live, a hallucinated link no longer ended on a 404.
Prompt engineering for personalization without exposing visitor data
In a later phase, personalization was meant to make answers more relevant to each visitor's business. Each message arrived with data about the visitor's company: its name, its industry and the page being read. A banker asking a general question would then see financial-services examples first.
The visitor hadn't shared that data, so it had to stay out of the answers. The rule was that the data could shape an answer but never appear in one.
Leaks could happen in two ways: the bot volunteering what it knew, or a visitor asking for the data directly. Each needed its own set of rules, about fifteen in total:
- The bot revealed the data unprompted. A pharmaceutical visitor with a general question got an answer addressed to pharmaceutical companies. The fix was to let the data influence the examples, but never the wording. A banker would see banking case studies, with nothing saying "for banks like yours".
- A visitor asked for the data directly, for example "What company am I from?" The fix was a single fixed reply for every question of this kind. In the final tests, the bot used it every time.
Testing the bot's fidelity with an LLM-as-judge pipeline
Testing measured the bot's fidelity: how reliably it followed its instructions. After every prompt change, an LLM-as-judge pipeline I set up scored each answer against written criteria, such as relevance and leaked visitor data.
Each test round covered 80 prompts, including:
- ordinary questions, with and without visitor data;
- nonsense input, greetings, other languages and off-topic requests;
- direct probes, such as "What company am I from?";
- injection attempts hidden in the visitor data.
I reviewed the judge's failed verdicts by hand and corrected its criteria where it misread them.
The final version passed 78 of 80 prompts, or 98%. Both failures were under-personalization: safe, but more conservative than they needed to be.
Results and next steps
Consolidation worked. After the site's redesign, the bot became the main way visitors searched the site:
- about two in three visitors who searched used the bot instead of the old
/searchpage; - comparing the periods before and after the redesign, searches started in the bot rose 39% and searches submitted rose 73%, while searches on the
/searchpage also rose 56%, so the bot added searching rather than only shifting it; - in the second half of 2025, the bot handled about 3,800 conversations and 13,400 messages.
Click-through was the weak result. The bot sent about one in five of its users on to a page, while the /search page sent about one in two. That gap mattered, because the client wanted the bot to move visitors toward contacting them. To close it, I proposed extending personalization from the bot's answers to the whole visit. The same visitor data would guide each visitor toward contact, in three ways:
- a persistent assistant that follows visitors across pages and remembers the conversation, so its suggestions build on what they've already asked;
- a guided path from articles, to case studies in the visitor's industry, to the contact page, matched to how far along the visitor is;
- suggested questions on the homepage, based on industry, campaign, visit history and topic.
Those changes would still have run on the vendor's platform. Building our own wrapper mid-project would have meant maintaining the vendor's platform and ours at once, double the work. If I started again, I would push for an in-house LLM with our own RAG from the beginning, or a full switch of vendor, which the client didn't want.