A worked example
A shopper asks for "something to fry pakoras in". Your product page says "cold-pressed groundnut oil, high smoke point, ideal for deep frying". A keyword search finds nothing in common except perhaps "fry". An embedding search places the question and the product close together, because their meanings are close, and the oil is retrieved.
How it is used in a RAG system
Every passage of your content is turned into an embedding once, when it is added. Every question is turned into an embedding when it arrives. The search then finds the passages whose embeddings are nearest to the question's, and scores each one by how close it is. Those scores are what a similarity threshold is applied to.
What embeddings are bad at
- Exact identifiers. Order numbers, SKUs and pincodes carry little "meaning", so embeddings match them poorly. A good system runs a keyword search alongside to catch them.
- Negation. "Is this suitable for diabetics?" and "this is not suitable for diabetics" are close in meaning-space, which is why the score alone should never decide what an answer says.
- Numbers and quantities. "500g" and "5kg" look similar to an embedding. Sizes and prices should come from structured product data, not from similarity.
Why a store should care
Embeddings decide which of your passages an answer is even allowed to consider. When a shopper's wording is far from yours, the right passage can score too low to be used. The fix is usually to add the words shoppers actually use to your page, or to write a verified answer, rather than to change anything technical.
Embeddings and languages
Modern embedding models place questions in different languages close to passages with the same meaning, so a question in Hindi can find an English page about the same thing. It works well for common topics and less well for regional product names and brand terms, which is one more reason a keyword search runs alongside, and one more reason to include the words shoppers actually use on your own pages, in the languages they use them.
How ChatWidget uses them: every passage and every question is embedded, a keyword search runs alongside for exact terms, and the score of each candidate appears in the trace.