Building a Coffee Recommender System with LLM and RAG

Aleksandr Yuryshev23 May 2026

Problem

A solo developer wanted to help people choose specialty coffee. Russia has about 700 roasters (roughly 100 large), each with its own assortment that changes every 2-3 months, because every harvest is a different product. Selection criteria depend on each other, and tasters name the same flavor differently, so exact-match search fails. Catalogs have no API, and a page carries about 16,000 lines of HTML per item.

Example from the article: the query "I want Ethiopian coffee, more bitter, for espresso" must return suitable lots from several roasters.

Solution in brief

Scrape each store with a custom crawler and store one document per coffee, with metadata and an embedding. A light LLM extracts hard filters from the query, and vector search runs inside them. A stronger LLM reranks only when similarity is low. Naive RAG took more than 5000 tokens per request, this version 600.

Questions this case answers
  • How to recommend items from a niche catalog with frequent turnover when user criteria depend on each other and are phrased differently from the catalog terms
  • How to combine metadata filters with vector search so a query never returns an empty result and the expensive model runs only when similarity is low
  • How to build a recommender for a niche catalog whose items change every 2-3 months
  • How to cut LLM tokens per request in a RAG recommender

Tools and methods

  • Hybrid search — metadata filter (origin, brewing method) plus similarity search on the query text
  • LLM-as-reranker — a senior model sees the top results only when similarity is low
  • Custom crawler — Python, requests and BeautifulSoup, written with LLM help for each store
  • GigaChat — light/Pro for query parsing, Pro/Max for reranking, embeddings for documents and queries
  • PostgreSQL (Neon) with pgvector, Next.js, Vercel, FastAPI, LangChain
Continue reading — it's free

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