Hey there! I have to build an AI agent that recommends products via Agentic RAG.
This is my context: My client needs an agent that recommends pieces of furniture based off the customer needs and specified dimensions. The problem is that the material(wood, steel, etc) and the dimensions are grouped together in the product description, hence I can’t perform a simple SQL query that retrieves some products solely based off the dimension(as the dimension in inserted in the description field, there is no dedicated column).
Therefore, I thought I could get as much detail as possible about the desired product and then perform simple RAG, but what is the dimensions of all the tables found are not close to the desired dimensions of the client? I can’t perform a SQL query…
So far I only have access to the API that returns all the products and also adds up filters for the products. But I already stored the products in Supabase just like in this video from Cole Medin:https://youtu.be/mQt1hOjBH9o?si=IH75O6C7gRitqL6M
This is the structure of a product:
{
“name”: “VIOLET Extendable bedspread”,
“id”:“194X.VIOLET.C”,
“code”: “68895512”,
“description”:“DIMENSIONS: Length: 290 cm Overall width: 192 cm Side width: 107 cm Seat depth: 60 / 90 cm Overall height: 76 / 95 cm Seat height from the ground: 44 cm Leg height: 5 cm Sleeping surface: 219 / 136 cm Storage box dimensions: 122 / 62 / 22 cm Product weight: 158 kg. Available colors for upholstery: (choose the desired texture and color from the configurator above). Positioning of the corner: (choose the position of the recliner from the configurator above). General information: Materials used in production: Solid wood, Pal Brut, Laminated wood, MDF, Vatelina, Melaminated wood (storage box), PFL White (storage box), metal. Seating: Sinusoidal arches, Vatelina, Polyurethane foam. Back: Vatelina, Polyurethane foam. Sofa back: Upholstery. Sleeping extension: Upholstery. Legs: Chromed metal / plastic. Storage space: storage box. Extension: double liege (DL). Other features: 3 large pillows; 2 small pillows - included. Quality guaranteed. We guarantee that this product is original and the company Möbelhaus is authorized to sell this product. *This product requires assembly. The assembly is quick and easy and can be carried out on the basis of the assembly instructions in the package. INFORMATION NOTE!!! Product photos are for presentation purposes. Between the photos displayed on the site and the products purchased may be slight differences in color or material. Dimensions are given with a tolerance of +/- 5 cm.”,
“priceWhole”: null,
“price_reduced”: null,
“category”:“LIVING”,
“subcategory”: “LIVING”,
“url”: “Coltar extensibil VIOLET | Möbelhaus | Mobileaza-ti casa cu stil!”,
“mainPhoto”: null,
“pictures”:
}
EXAMPLE:
#Current Case
Just to make it more clear:
User: I need a kitchen table with the length of 120 centimeters[then gives more details, such as the desired material]
Agent: [Performs RAG, finds products, but it finds 200 products, now it has to filter the results based off the LLM thinking, NOT SQL query since the properties or the products are directly embedded in the description]. Okay so I found X product, 130 cm in length, Y product, 100 cm in length etc. [The problem stems from the fact that a few hundred of products would exceed the ]
#Desired Case:
User: I need a kitchen table with the length of 120 centimeters[then gives more details, such as the desired material]
Agent: [Performs RAG, and finds 300 products. Now it fetches the most relevant products based off the dimension ‘field’, like this:
row_data->>'Product' AS product_id,
row_data->>'Url' AS url,
row_data->>'desc' AS description,
row_data->>'dimension' AS dim,
CAST(row_data->>'price' AS DECIMAL) AS price
FROM
rp_rows
ORDER BY
CAST(row_data->>'price' AS DECIMAL) ASC
LIMIT 10;
Okay so I found these tables that have the closest dimensions X, Y etc.
user:thanks!
P.S. I embedded in Supabase the product name along with the description. That’s how I retrieve the relevant products, but as I said, I need a more robust approach which involves SQL queries + vector search(as per the mentioned video).
Thanks in advance!