Scenario
A consulting CTO collaborating with a roofing company proposed using a Retrieval-Augmented Generation (RAG) approach powered by a Large Language Model (LLM) to enhance the sales process. The goal is to engage potential customers, build trust, and connect them with sales representatives as warm leads.
Solution
The proposed solution involves deploying an LLM-driven chatbot on the company’s website. Visitors can interact with the bot to learn about roofing services, understand the process, and feel more comfortable moving forward with a purchase. When the bot encounters questions it cannot answer, it seamlessly hands the conversation off to a human salesperson, ensuring the lead is warm and ready for further engagement.
The chatbot is built on a RAG LLM framework and the documents in the vector database can be curated by the roofing company. By leveraging this approach, the risk of incorrect or misleading information is removed and preserves customer trust.
Code
The goals of the chatbot is for the customer interaction to be informative and result in a warm lead. The design of the code to meet these goals focuses on three areas: the prompt creation, warm hand-off, and knowledge improvement.
Prompt Management
A prompt template is used in building the prompt that is passed to the LLM. Along with the context, the user’s query, and the documents, there are two instructions to the LLM to manage the process.
- Answer only based on information from the documents stored in the vector database.
- Respond with “I don’t know” if sufficient information is unavailable to
maintain credibility.
This prompt template manages the response from being hijacked by the visitor or producing hallucinations which can diminish the roofing company’s credibility. Additionally the prompt template does not use history, which is an acceptable trade off decision to be more informative while removing the interactive attribute.
Warm Hand-Off
When the document-store’s knowledge is exhausted, the chatbot offers to hand the discussion to a human. This approach is more controlled than allowing the LLM to provide its own answer. More importantly, this response not only ensures the chatbot remains trustworthy but also creates opportunities to capture valuable leads.
Knowledge Improvement
To enhance the chatbot’s performance over time, unanswered questions are logged for review. These logs serve as a foundation for improving the chatbot’s knowledge base by identifying gaps. New documents can be sourced or created to address these gaps, and a script updates the vector store with the additional information. Regular reviews and updates ensure the chatbot stays relevant and effective.
The source code is available on Github: link to code repo