Map marketplace product categories with Gemini embeddings and a review queue

Go to Workflow
0 views
Built by Leonid Leonid
Created on October 21, 2026

Description

Quick overview
This workflow uses n8n Data Tables and Google Gemini embeddings to map product listings to the best matching marketplace category, automatically applying high-confidence matches and routing uncertain results to a human review queue.

How it works
Manually runs a one-time setup that creates two n8n Data Tables and inserts demo categories and products.
Manually runs an indexing step that reads all category paths, generates Google Gemini embeddings, and stores them in an in-memory vector store.
Manually starts the mapping step that loads pending products from the products Data Table and processes them one at a time.
For each product, generates a Google Gemini embedding and retrieves a shortlist of the most similar categories from the in-memory vector store.
Uses the Google Gemini chat model to pick a single category_id (or NONE) from the shortlist and returns a structured reason.
Validates the pick against the shortlist and a similarity threshold, then updates the product row as either mapped (with category details) or needs_review (with candidates and review reason).

Setup
Create a Google Gemini (PaLM) API credential and select it for both Gemini embedding nodes and the Gemini chat model node.
Run “Run once: create tables and demo data”, then replace the demo rows by importing your own category tree and products into the marketplace_categories and products_to_map Data Tables.
Run “Step 1: index the category tree” after any n8n restart or category-tree change, since the in-memory vector store is cleared on restart.
Review and adjust the shortlist size and minimum similarity threshold (shortlist_size and min_top_score) to control auto-mapping versus the needs_review queue.

Requirements
n8n with Data Tables (tested on n8n 2.44.5) and a Google Gemini API key; the free tier is enough to try it.

Customization
min_top_score (0.62) is only a starting point: run 20-30 products, compare top_score of right and wrong picks and set the threshold between them. The in-memory store is cleared on restart, so re-run Step 1 or swap it for Qdrant, Supabase or PGVector.

Additional info
Tested end to end on the demo data with a real Gemini key: the cordless drill and the cast iron skillet were mapped to the right leaf categories, and the karaoke microphone (no fitting category in the demo tree) went to needs_review instead of getting a wrong category. The model never decides alone: a Code node checks that the picked id is in the shortlist and that the best similarity clears the threshold.

This workflow was created by Leonid and shared publicly on the n8n community template library. n8nFind indexes it for discovery — the workflow remains the property of its original creator.

Nodes Used (7)

Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm
Code
n8n-nodes-base.code
Default Data Loader
@n8n/n8n-nodes-langchain.documentDefaultDataLoader
Embeddings Google Gemini
@n8n/n8n-nodes-langchain.embeddingsGoogleGemini
Google Gemini Chat Model
@n8n/n8n-nodes-langchain.lmChatGoogleGemini
Simple Vector Store
@n8n/n8n-nodes-langchain.vectorStoreInMemory
Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured