Subtitle: Learn How the Retriever Prevents Wrong Answers in an AI Shopping Assistant Using RAG.
Imagine This: A Customer Needs a Winter Wedding Outfit
Varastra is an Indian ethnic wear e-commerce platform selling sarees, kurtas, lehengas, and festive clothing.
A customer asks the AI shopping assistant:
"Suggest an outfit for a winter wedding."
But what if Varastra's product database contains no verified information about winter wedding outfits?
Should the AI guess and recommend something anyway?
No. A reliable AI shopping assistant must know when it has enough information to answer and when it should admit that it cannot find a suitable match.
This is where the Retriever becomes important.
Let's understand how it works.
1. What Is a Retriever?
A retriever is a component in a Retrieval-Augmented Generation (RAG) system that finds relevant information from a knowledge source.
For Varastra, that source might contain:
- Product descriptions.
- Fabric information.
- Occasion details.
- Care instructions.
- Return policies.
- Product specifications.
When a customer asks a question, the retriever searches for information that matches the request.
But finding similar information is only part of the job.
A well-designed retrieval pipeline must also decide whether the returned information is relevant enough to use.
Think of the retriever as a gatekeeper.
It helps determine which evidence reaches the language model and which information should be withheld.
2. Step One: Convert the Customer's Question into a Vector
The customer asks:
"Winter wedding outfit."
The embedding model converts this question into a numerical representation called a vector.
In the diagram, the vector has 1,536 dimensions.
These numbers help the search system compare the meaning of the customer's question with stored product information.
For example, Varastra might have product descriptions such as:
- Velvet lehenga for winter weddings.
- Silk saree for festive occasions.
- Lightweight cotton kurta for summer.
- Linen co-ord set for everyday wear.
The goal is to find products that match the customer's needs.
Important: The vector represents the meaning of the query. It does not contain verified product facts by itself.
3. Step Two: Search ChromaDB
After creating the query vector, the retriever searches ChromaDB.
ChromaDB is a vector database that can store embeddings and associated product information.
It helps the application find product records whose vectors are similar to the query vector.
For example, the search might return:
| Product | Similarity Score |
|---|---|
| Velvet Lehenga | 0.89 |
| Silk Saree | 0.82 |
| Cotton Kurta | 0.61 |
| Linen Co-ord | 0.48 |
These are illustrative scores for this example.
The velvet lehenga and silk saree appear more relevant to the request than the cotton kurta and linen co-ord.
However, similarity alone does not prove that a product is suitable for winter or a wedding.
The retriever must provide the relevant product descriptions, and the application should verify any important claims against reliable product data.
4. Step Three: The Threshold Gate
This is the most important part of the diagram.
The retriever uses a similarity threshold to help decide which results can be passed to the language model.
In the diagram, the threshold is set to 0.75.
The rule is:
- Similarity score ≥ 0.75 → Pass.
- Similarity score < 0.75 → Withhold.
Using the illustrative scores above:
| Product | Score | Decision |
|---|---|---|
| Velvet Lehenga | 0.89 | Pass |
| Silk Saree | 0.82 | Pass |
| Cotton Kurta | 0.61 | Withhold |
| Linen Co-ord | 0.48 | Withhold |
The two stronger matches pass the threshold. The other two are excluded from the usable retrieval results.
This helps prevent the language model from relying on weakly related information.
Does a score of 0.75 mean the product is 75% relevant?
No.
A similarity score is not necessarily a percentage or probability. Its interpretation depends on the embedding model and the similarity measure.
The threshold must be tested against real customer questions and product data. A value of 0.75 is an example, not a universal rule for every RAG system.
The key lesson: A retriever should not treat every search result as good evidence.
5. What Happens When Relevant Evidence Passes?
Suppose the retriever finds this product information:
Product: Velvet Lehenga
Description: Velvet lehenga suitable for winter weddings and festive occasions.
The retriever passes this information to the language model.
The model can now generate an answer based on the retrieved evidence.
For example:
"You could consider the Velvet Lehenga. Its product description identifies it as suitable for winter weddings and festive occasions."
This answer is grounded in the available product information.
Before making additional claims about size, price, or availability, the application should verify those details using Varastra's current product records.
The process is:
Customer Question → Embedding → ChromaDB Search → Threshold Check → Retrieved Evidence → Language Model → Answer
6. What Happens When Nothing Passes the Threshold?
Now imagine Varastra has no relevant winter wedding products in its database.
The retriever searches ChromaDB, but every result falls below the configured threshold.
What should happen next?
The system should withhold the weak results rather than pass them to the language model as if they were reliable evidence.
The application can then return a fallback response.
For example:
"I couldn't find a suitable match in our current product information. Please contact support@zudyog.in for assistance."
This is called a fallback response.
Instead of inventing a recommendation, the assistant explains the limitation.
That protects the customer from misleading information.
Why Is This Important?
Imagine a customer is buying an expensive outfit for a wedding.
If the AI recommends a product without reliable evidence that it suits the occasion, the customer may make the wrong purchase.
An honest response is better than a confident guess.
A good AI assistant must know when not to answer.
7. What Is Grounding Failure?
A grounding failure occurs when the system cannot find sufficient relevant evidence to support an answer.
For example:
- The customer asks about a winter wedding outfit.
- The database returns only unrelated summer clothing.
- No result meets the configured retrieval requirements.
- The system withholds the results.
The information needed to answer may be missing, outdated, or poorly organized.
The correct response is not to force an answer.
Instead, the system should acknowledge that it could not find a reliable match.
This is what the diagram means by:
"Grounding failure → admitted correctly."
The retrieval process failed to find acceptable evidence, but the application handled that failure honestly.
A grounding failure does not always mean the product is missing. The search might also fail because of poor chunking, unsuitable embeddings, strict thresholds, or incomplete indexing.
8. Why Is the Retriever More Than a Search Engine?
A basic search retrieves matching results.
A RAG retriever is part of a larger process that determines which retrieved information will be supplied to the language model.
It can work with:
- Vector similarity.
- Similarity thresholds.
- Metadata filters.
- Product categories.
- Additional ranking rules.
- Retrieval limits.
For example, a customer might ask:
"Show me a red saree under ₹5,000."
Varastra may need to combine semantic search with structured filters for color and price.
It should also check current availability before recommending a product as available.
The goal is not simply to retrieve something similar. It is to retrieve information that is relevant to the customer's actual request.
9. How Does the Retriever Fit into RAG?
Here is the complete workflow:
- Customer Query: The customer asks a question.
- Embedding Model: The question is converted into a vector.
- ChromaDB Search: The database returns similar product records.
- Threshold Gate: The application filters results according to its retrieval rules.
- Retrieved Evidence: Acceptable product information is passed forward.
- Language Model: The model uses the evidence to prepare a response.
- Grounded Answer: The assistant gives an evidence-based answer.
- Fallback Response: If sufficient evidence is unavailable, the assistant explains that it cannot find a suitable match.
Complete flow:
Customer Question → Embedding Model → ChromaDB → Retriever Threshold → Evidence → Language Model → Grounded Answer
If no acceptable evidence is found:
Retriever → No Suitable Evidence → Fallback Response
One important technical detail: a similarity threshold alone cannot guarantee a correct answer. The application should also check whether the retrieved content actually supports the proposed response.
10. Key Takeaways
Remember these five ideas:
- The retriever finds relevant information from a knowledge source.
- ChromaDB helps search product vectors to identify similar records.
- The threshold gate filters weak matches according to a configured rule.
- The language model uses retrieved evidence to generate a response.
- The fallback response handles missing evidence without encouraging the AI to invent an answer.
The retriever is an important part of a reliable RAG system because it controls what information reaches the language model.
The big lesson: A trustworthy AI shopping assistant doesn't answer every question. It answers when it has enough evidence—and admits when it doesn't.
