Subtitle: Discover How AI Searches Products by Meaning, Not Just Keywords.
Imagine This: A Customer Is Shopping on Varastra
Varastra is an Indian ethnic wear e-commerce platform selling cotton kurtas, linen co-ord sets, sarees, Anarkali suits, and festive outfits.
A customer asks the AI shopping assistant:
"I need something light and comfortable for summer."
The customer has not mentioned a specific product name. How can AI find the right products from thousands of items?
The answer is ChromaDB and vector search.
Let's understand how they work, step by step.
1. Customer Question: Understand What the Customer Wants
The customer enters:
"Light fabric for summer."
Varastra needs to find products that match this request.
For example:
- A lightweight cotton kurta.
- A breathable linen co-ord set.
- Other clothing suitable for warm weather.
The challenge is that product descriptions may use different words from the customer's question.
A product might say "breathable linen for warm weather" instead of "light fabric for summer."
A basic keyword search might miss this connection. Semantic search can help identify the relationship between these phrases.
2. Embedding Model: Convert Text into Numbers
An embedding model converts text into a list of numbers called a vector. This numerical representation helps a computer compare the meaning of different pieces of text.
In the diagram, the model is text-embedding-3-small, which produces a 1,536-dimensional vector.
The process looks like this:
Customer's Question → Embedding Model → Query Vector
For example:
- Input: "Light fabric for summer"
- Output: A vector containing 1,536 numbers.
These numbers represent the text in a form that can be compared with product vectors.
The vector is not simply a list of word IDs. Together, its numbers form a representation that helps capture relationships in meaning.
3. Query Vector: Represent the Search Request
The query vector represents what the customer is looking for.
Varastra's product descriptions have also been converted into vectors and stored in a database.
For example:
| Product | Description |
|---|---|
| Cotton Kurta | Lightweight cotton for everyday summer wear |
| Linen Co-ord | Breathable linen clothing for warm weather |
| Anarkali Suit | Traditional outfit for festive occasions |
| Woollen Shawl | Warm clothing for cold weather |
The search system compares the query vector with the stored product vectors to find relevant candidates.
Important: The query vector helps find product records. The actual product details must also be retrieved to answer the customer accurately.
4. ChromaDB: The Searchable Memory of Products
ChromaDB is a vector database that stores embeddings and can associate them with text, product information, and metadata.
For Varastra, it can store product vectors alongside details such as product IDs, descriptions, and categories.
When a customer asks a question, ChromaDB searches the stored vectors for similar matches.
Think of it as a searchable library of product information.
Instead of checking every description manually, the system can use vector search to retrieve a smaller set of relevant products.
For example, if Varastra has thousands of products, ChromaDB can help find a few candidates that match the customer's request.
The actual speed and quality depend on the database configuration, index, and product data.
5. Similarity Scores: How Closely Does a Product Match?
The diagram shows these example results:
| Product | Similarity Score | Result |
|---|---|---|
| Cotton Kurta | 0.89 | Accepted |
| Linen Co-ord | 0.87 | Accepted |
| Anarkali Suit | 0.71 | Rejected |
| Woollen Shawl | 0.53 | Rejected |
These scores are illustrative.
In this example, the system uses a similarity threshold of 0.75.
This means:
- A product meeting the threshold can be included in the results.
- A product below the threshold is excluded.
The Cotton Kurta scores 0.89, so it passes the threshold.
The Linen Co-ord scores 0.87, so it also passes.
The Anarkali Suit scores 0.71, so it does not pass.
The Woollen Shawl scores 0.53, so it does not pass either.
Does a score of 0.89 mean the product is 89% correct?
No. A similarity score is not a percentage chance that the answer is correct.
Its meaning depends on the embedding model and the similarity measure being used. The threshold should be tested against real customer questions and product data.
A high similarity score also does not guarantee that the product is within budget or in stock. Those details must be checked separately.
6. Nearest Neighbours: Find the Closest Matches
Imagine placing the customer's question and all the product vectors in a mathematical space.
Some product vectors are closer to the query vector than others.
The search system finds the closest candidates according to its similarity or distance measure. These candidates are called nearest neighbours.
In Varastra's example:
- Cotton Kurta is the closest match.
- Linen Co-ord is the second closest match.
- Anarkali Suit is less similar.
- Woollen Shawl is even less similar.
The system ranks the results and returns products that meet its configured rules.
This helps customers discover products even when they do not know the exact product name.
7. Retrieved Evidence: Give the AI Useful Information
After searching, the system returns relevant product records.
In the diagram, the retrieved evidence contains:
Rank 1: Cotton Kurta
- Similarity: 0.89
Rank 2: Linen Co-ord
- Similarity: 0.87
The system can retrieve the product descriptions and other relevant attributes.
For example:
Product 1:
Name: Cotton Kurta
Description: Lightweight cotton for everyday summer wear
Product 2:
Name: Linen Co-ord
Description: Breathable linen clothing for warm weather
This information becomes the evidence the language model can use to prepare an answer.
Similarity scores alone are not enough. The application must retrieve the actual product details needed to support its recommendations.
8. Language Model: Turn Evidence into an Answer
The language model receives the customer's question and the retrieved product information.
It uses this context to generate a natural-language response.
For example:
"For summer, I recommend the Cotton Kurta because its description mentions lightweight cotton for everyday wear. The Linen Co-ord is another option because it is described as breathable clothing for warm weather."
The model uses the retrieved descriptions to explain the recommendations.
It should not invent missing information. If the system does not have a verified price, it should not make one up.
Remember: ChromaDB helps find relevant evidence. The language model uses that evidence to explain the results.
9. Grounded Answer: Help the Customer Choose
The final step is the grounded answer.
The shopping assistant presents useful recommendations based on the retrieved product information.
Varastra might show:
- Product names and images.
- Fabric descriptions.
- Prices.
- Available sizes.
- Product page links.
Before showing changing details such as price and stock, the application should verify them against Varastra's authoritative commerce system.
If no suitable products are found, the assistant should explain that it could not find a match rather than inventing a product.
10. The Complete Process
Here is the complete workflow:
| Step | Component | Purpose |
|---|---|---|
| 1 | Customer Question | Receives the customer's request. |
| 2 | Embedding Model | Converts the question into a vector. |
| 3 | Query Vector | Represents the question numerically. |
| 4 | ChromaDB | Searches stored product vectors. |
| 5 | Similarity Threshold | Filters results using the configured rule. |
| 6 | Retrieved Evidence | Supplies relevant product information. |
| 7 | Language Model | Uses the evidence to prepare a response. |
| 8 | Grounded Answer | Presents the response to the customer. |
Customer Question → Embedding Model → Query Vector → ChromaDB → Similarity Search → Retrieved Evidence → Language Model → Grounded Answer
11. Why Does This Matter for E-commerce?
Customers do not always know the exact names of the products they want.
They might ask:
- "Something light for summer."
- "Comfortable clothes for hot weather."
- "An outfit for the office."
- "Breathable ethnic clothing."
These phrases use different words, but their meanings may overlap.
Semantic search helps Varastra connect customer questions with relevant product descriptions.
It works best when combined with filters for price, size, color, category, and stock availability. This helps the system find products that are both relevant and suitable for the customer's requirements.
Key Takeaways
Remember these five ideas:
- Embedding models convert text into numerical vectors.
- Query vectors represent what customers are looking for.
- ChromaDB searches stored vectors to find similar products.
- Similarity scores help rank and filter search results.
- Language models use retrieved information to generate helpful answers.
ChromaDB does not generate the final answer. It helps the application find relevant information that the language model can use.
The big idea: Customers can describe what they want in their own words, and AI can help them find relevant products without requiring an exact keyword match.
