Why every growing e-commerce store hits the same wall

Pre-sales support is the hidden bottleneck of online retail. Customers ask the same questions thousands of times: product dimensions, style compatibility, installation instructions, pricing for custom wall sizes. Each answer is simple. The volume is not.

Hiring more support staff scales the cost linearly with traffic. A generic chatbot gives generic answers and loses trust the moment it gets a price wrong. The real solution requires something that can handle both semantic questions ("something calm and modern for a bedroom") and hard factual lookups ("what is the exact price of SKU 000389 with 10% waste margin") โ€” without confusing the two.

That is the problem Hybrid RAG solves. And it is the architecture we built for da-vinchi.pl.

The core architectural decision: two truth layers

A plain LLM over documents hallucinates prices. A pure SQL bot misses semantic intent. Hybrid RAG splits knowledge into two layers: SQL for hard facts (price, SKU, stock), pgvector for soft knowledge (style, room guides, FAQ). The agent queries both โ€” and never invents a number it did not retrieve from the database.

The full pre-sales conversation โ€” without staff

"Show me wallpapers for a kids room with flowers"
Semantic search across 1,200 SKUs โ€” instant shortlist with exact prices, no manual filtering
"Price for SKU 000389, does it come in a set?"
Direct catalog lookup โ€” precise specs from SQL, no estimating, no errors
"How do I hang it? What glue do I need?"
Knowledge base answers from company materials โ€” installation guides served instantly
"My wall is 3.2m x 2.6m, how much will it cost?"
Price calculation with waste margin โ€” exact total, no back-and-forth with staff

How the two-layer knowledge system works

The fundamental architectural decision is to separate hard facts from soft knowledge and retrieve them through different paths.

User query: "Something calm for a bedroom, around 120 PLN"
  โ†“
LangGraph ReAct agent โ€” decides which tools to call
  โ†“                                              โ†“
pgvector (Supabase)                   PostgreSQL (Supabase)
semantic: "calm bedroom style"      SQL: price BETWEEN 100 AND 140
โ†’ style guides, room matches        โ†’ SKU, exact price, stock_status
  โ†“                                              โ†“
Agent merges results โ€” product shortlist with real prices โ†’ reply

SQL layer (hard facts): SKU, final_price, stock_status, route, colors, room tags. The agent never constructs a URL or price from memory. Every number shown to the customer comes from a live database query.

pgvector layer (soft knowledge): 142 semantic chunks across 5 types โ€” FAQ, technical specs, style guides, room recommendations, sales scripts. Queries like "something for a Scandinavian interior" trigger vector similarity search, return the right style context, which then feeds into SQL filters.

What each tool does and why it exists

search_knowledge
Semantic retrieval from pgvector โ€” style mapping, room guides, FAQ, installation. Handles the "soft" questions that have no single correct SQL answer.
search_catalog
Faceted SQL search with progressive fallback logic: relaxes filters step by step if initial results are too narrow. Prevents "no results" dead ends.
get_product_details
Direct lookup by SKU, product_id, or URL slug. The primary anti-hallucination tool โ€” called whenever the agent needs to confirm a price or specification before presenting it.
compare_styles
Retrieves and compares two product styles side by side for a customer's specific use case. Handles "which is better for X" questions without generic answers.
calculate_wall_price
Computes total cost by wall dimensions including standard waste margin. Replaces the most common back-and-forth between customers and support staff.

How the knowledge base is built

Two independent pipelines feed the system:

Catalog import: CSV from the store's backend โ†’ deduplication โ†’ out-of-stock filtering โ†’ 355 active SKUs in PostgreSQL. Re-runnable without duplicates.

Knowledge base build: Structured markdown documents โ†’ 142 chunks across 5 semantic types. Chunking strategy varies by document: FAQ splits per question, room guides carry structured metadata, style mappings include color and category fields.

Both pipelines run independently and can be re-triggered when the product catalog or policies change.

What shipped

  • 355 active SKUs in structured SQL
  • 142 semantic knowledge chunks in pgvector
  • 5 agent tools covering the full pre-sales flow
  • Zero hallucinated prices in production testing
  • Full web chat widget embedded on the store
  • LangSmith tracing for every agent run
  • pytest buyer-scenario integration tests on CI

Common questions about AI customer service automation

How does a RAG chatbot handle product recommendations without hallucinating prices?
The key is splitting knowledge into two layers. Hard facts โ€” SKU, exact price, stock status โ€” are stored in SQL and fetched directly. The agent never constructs a price from memory. Soft knowledge โ€” style guides, room recommendations โ€” lives in a vector store for semantic search. The agent only presents prices it retrieved from SQL, making hallucination structurally impossible.
What queries can an AI sales assistant handle without human intervention?
A well-built RAG agent handles the full pre-sales conversation: semantic product search, exact SKU lookups with price and stock, installation and application questions, return policy and FAQ, and price calculations by wall dimensions. Post-purchase queries (order status, shipping) still need a human or a separate integration.
What is Hybrid RAG and why is it better for e-commerce?
Hybrid RAG combines vector similarity search (for semantic queries) with structured SQL retrieval (for hard facts like price and SKU). Pure vector search hallucinates prices. Pure SQL misses semantic intent. The hybrid approach handles both โ€” and is the right architecture for any product catalog with both factual and descriptive attributes.

Tools used

Python LangGraph FastAPI Supabase pgvector (HNSW) Google Gemini Sentence-Transformers LangSmith Docker Railway GitHub Actions pytest VS Code + Claude Code
Want to automate customer service for your online store?

I build RAG-based sales agents for e-commerce: product catalog integration, semantic search, price calculations, FAQ handling. Works with any product catalog โ€” wallpapers, furniture, electronics, B2B supplies. Based in Munich, working with clients across Europe.

โ† Back to articles