Insights
Transitioning From Data to Dialogue - Development Strategies for an LLM-Powered Chatbot

In the current digital landscape, companies are seeking innovative methods to simplify online interactions. Many online shoppers face challenges in locating pertinent information and support for the products they want. Unlike a brick-and-mortar store, where helpful staff can guide customers to suitable options, online spaces can overwhelm users with an excess of data.
This initiative seeks to address this issue by providing customized shopping assistance that caters to unique user needs. The objective is to enhance the overall shopping experience by rectifying the limitations of standard online engagement. The proposed solution is a chatbot, built on a Large Language Model (LLM) and supplemented with relevant information. This project leverages a method known as Retrieval-Augmented Generation (RAG). Although primarily designed for a hardware store, the chatbot can be customized for various applications.
The chatbot acts as an AI assistant, allowing users to converse, access product details, and get help with their DIY endeavors. The central theme of this research is: “How can we enhance the functionality of an AI-enabled chatbot to better assist users in finding information about DIY projects and product suggestions?”
By addressing this query, we aim to offer actionable insights into enhancing AI-powered chatbots, ultimately creating a more user-friendly and supportive online shopping environment.
Product
The chatbot utilizes an LLM to respond to user inquiries. In addition, it accesses product information and expert articles stored in a vector database. The outcome of this initiative is a proof-of-concept showcasing the capabilities of generative AI within e-commerce. The following illustration exemplifies how the chatbot can be utilized.

As illustrated, the response includes several links directing users to relevant products. Additionally, the response concludes with a link to a blog post that provides more pertinent details.
Workflow
To grasp how the chatbot operates and influences user interactions, let’s explore the sequence of steps it follows to deliver tailored information:
- User Query Submission: The process initiates when a user submits an inquiry to the chatbot about DIY projects or product suggestions.
- Query Refinement: The chatbot enhances the user’s inquiry by sending a request to the OpenAI API, using the conversation history for context.
- Query Classification: A request is made to the OpenAI API to categorize the refined query into distinct classes, like ‘recommendations,’ ‘comparisons,’ ‘step-by-step guides,’ ‘availability,’ or ‘other.’
- Product Retrieval: The chatbot obtains the top products most pertinent to the user’s inquiry from the vector database. This ensures accurate and context-aware product suggestions.
- Blog Retrieval: Simultaneously, the chatbot retrieves the most relevant blog entries connected to the user’s inquiry from the vector database, along with a selection of relevant blog segments.
- Specification Generation: The chatbot makes a request to the OpenAI API to produce a list of product specifications based on the user’s query and the sourced blogs.
- Additional Product Retrieval: For each listed product specification, the chatbot further refines the information by fetching additional products that align closely with the user’s inquiry from the vector database.
- Response Generation: Ultimately, a request is sent to the OpenAI API to generate a thorough response to the user’s inquiry. The chatbot leverages the classified query, blog insights, and product data to create a comprehensive and contextually relevant reply.
Model Development
To gauge the advancements in the chatbot’s functionality, we employ a systematic framework that involves evolving through various versions. This methodology allows for straightforward comparisons between iterations, enabling us to build on the achievements of previous versions.
Conclusion
To optimize the AI-powered chatbot for DIY projects and product recommendations, we progressed through multiple versions. Techniques such as prompt engineering and query classification were implemented to enhance user interactions. Achieving a balance between complexity and efficiency involved judicious model selection and disaggregating data for better cost management. The final iterations prioritized speed by simplifying data, while the most proficient version utilized model fine-tuning to enhance efficacy.
The outcomes clearly indicate that placing a strong emphasis on prompt engineering significantly boosts the chatbot’s performance. Improvements in cost management reveal the necessity of addressing factors beyond mere accuracy. Fine-tuning serves as a powerful mechanism for enhancing performance while maintaining low costs and response times.

Emma Beekman
Intern Data Science at Squadra Machine Learning Company
