Transforming E-commerce with a Conversational Search Assistant Powered by Large Language Models

Narendra Parigi3 Jan 2024

Problem

A classifieds marketplace wants buyers to describe what they need in plain language and get matching listings. The search API only understands attribute filters, so something must turn a chat into filter values. A general chat model also suggests cars that may not be in the marketplace inventory, and a long extraction prompt that lists every attribute and value makes each turn slow.

Example from the article: a car-category prototype for the French market: the user chats about fuel type, price or colour, and the assistant proposes cars and runs the search.

Solution in brief

Split the assistant into separate LLM calls: one talks, one extracts preferences into JSON for the search API, one suggests next steps. Fine-tune the extraction model on generated conversation-to-JSON pairs so it no longer needs the long prompt. Check the cars the chat model suggests against a knowledge graph of the marketplace inventory and rewrite the answer to match.

Questions this case answers
  • How to convert a multi-turn free-text dialogue into structured filters for an existing search API when a long extraction prompt makes inference too slow
  • How to keep generated item suggestions consistent with what is actually available in a catalog
  • How to let buyers search a marketplace by chatting in natural language instead of filling in filters?
  • How to turn a free-form conversation into structured search-API filters with an LLM?

Tools and methods

  • GPT-3.5 (gpt-3.5-turbo) — conversation, extraction, guidance, knowledge and sample-generation models
  • Prompt chaining — one LLM call per job, passing only the last two messages to the extraction and guidance steps
  • Supervised fine-tuning — teaches the extraction model to output JSON without a long attribute prompt
  • Synthetic data generation — builds training conversations from random JSON and from real search filters
  • Knowledge graph with SPARQL — checks which suggested cars exist in the inventory
Continue reading — it's free

Google or a one-time email code. No password.