To achieve this, we'll combine SQL's strength in handling structured data with LLMs' ability to understand language like humans do. This opens up many possibilities: enabling conversational interactions, refining recommendations based on nuanced user inputs, and creating systems that adapt to individual customer preferences and behaviors.

This will be the first playbook in a series of four, in which we will develop the infrastructure for SQL-based product analytics using LangChain, LangGraph, and LLMs. In this playbook, we will start building the SQL infrastructure and see how we attach the resulting recommendation class to LLMs as tools.

The Business Problem

One of the most potent analyses you can make when it comes re-activating customers, is to predict what the customer wants to buy next.

Order journeys contain hints about what the customer wants next.

The more historical purchase data you have, the more precise your predictions can become. By leveraging SQL for structured data manipulation and combining it with an LLM's ability to understand and generate human-like text, you'll be able to:

  • Personalize recommendations by tailoring suggestions based on a customer's revealed purchase preferences.
  • Enable conversational queries using LLMs to interpret user intents expressed in natural language and convert them into queries that fetch precise, relevant recommendations.
  • Streamline development by building modular, scalable SQL components that interface with LLMs, ensuring a maintainable system for various use cases.
🚀
By the end of this playbook, you'll have a valuable tool that allows you to figure out what to promote to an existing customer for reactivation.

We'll work with real Shopify data, making our solution practical and ready to use in real-world scenarios. This approach allows us to leverage the strength of SQL for data processing and the scalability of BigQuery for handling large datasets efficiently.

SQL-Based Recommendations

Next-product recommenders can boost sales by putting the right products in front of customers at the right time. They improve customer experience by helping shoppers find what they need faster. They also increase customer loyalty by showing that you understand and cater to their preferences.

This post is for paying subscribers only

Sign up now and upgrade your account to read the post and get access to the full library of posts for paying subscribers only.

Sign up now Already have an account? Sign in