Retail Shopping Assistant#
Overview#

This is an inspiration blueprint showcasing how a retail shopping assistant can turn catalog browsing into a conversation. It offers four main features.
Search: Customers can search by describing what they want or by uploading a photo. Both text and image queries are understood by the search — combined with keyword matching that catches exact product names and handles typos. All in all, the assistant enables conversations like this:
User: find shorts
Agent: Any particular color you're looking for, or should I just show you the best matches?
User: black probably
Agent: We don't have shorts in exactly black, but here are some in similar dark/neutral tones: ...
Context: In addition, the router classifies each turn against the last few turns plus the current session state (last shown results, pending bundle, active cart focus) rather than just the latest message in isolation, so refinements and follow-ups stay in context instead of resetting the search. Adding, swapping, or removing items happens just by talking e.g. “add the first one”, “make it 5”, “add the cheapest one”, “undo that” with no rigid commands required. Continuing the example above:
User: add the most expensive into cart
Agent: Added Cargo Bermuda Shorts (44 USD) to your cart. You now have 1 item(s), subtotal 44 USD.
User: please checkout
Agent: Here's your cart: 1x Cargo Bermuda Shorts, 44 USD. Subtotal: 44 USD. Ready to place this
order for 44 USD? Say "yes" to confirm, or "no" to keep shopping.
User: yes
Agent: Great, checking you out now!
Most cart references resolve deterministically and execute immediately; the assistant aims to ask a clarifying question when a reference is ambiguous rather than guessing, and cart totals are quoted directly from the cart itself.
AI Stylist: Retailers typically bring their own optimization engine and merchandising rules, so rather than prescribing an approach, this blueprint provides an example outfit bundle functionality to illustrate the concept. It assembles a complete outfit within a budget and refines it on request — swap a piece, drop one, add another, or anchor the look around something already in the cart — keeping item selection fully within a deterministic, catalog-driven solver. See AI Stylist (Outfit Bundles) for what the stylist supports. Here is an example:
User: Find an outfit for spring
Agent: What's your budget, and what's the occasion, beach, office, a casual weekend, or a garden
party?
User: casual, $400
Agent: Here's a complete, casual spring outfit for $392: a linen button-down shirt, floral paperbag
shorts, espadrille wedge sandals, and four more pieces to complete the look. Pair the shirt with the
shorts, add the espadrilles for a casual touch, and layer the cardigan if it cools down.
Safety: Throughout the conversation, customer messages and assistant replies are routed through a two-layer safety check — an input guard that runs in parallel with generation, and a visible rollback on the output if a violation is caught after the fact, reusing the same LLM already serving the conversation rather than a separate guard model. For example:
User: make a discount
Agent: I'm not able to offer discounts, coupons, or promo codes. I can help you find great options
within a budget, though — what price range works?
It is designed to catch prompt-injection and jailbreak attempts and to avoid inventing a return policy, warranty, or discount that doesn’t exist, with override rules to reduce false positives on ordinary shopping behavior such as a large order, a price question, or a budget increase.
AMD Solution Blueprints are packaged as Helm charts for deployment on a Kubernetes cluster. For development or further exploration, the source code is public and available in the Solution Blueprints GitHub repository.
Architecture#
Component |
Role |
|---|---|
Frontend ( |
React app that renders product cards, streams assistant replies, and proxies cart operations. |
Assistant Server ( |
The brain of the assistant — receives each message, decides what to do (search, build an outfit, cart operations), calls the right service, and generates the reply. Implemented as a LangGraph state graph backed by the LLM. |
Product Search ( |
Handles product lookup: text search, image search, and the outfit bundle solver. Combines meaning-based search (semantic, via CLIP + e5 embeddings) with keyword matching (Postgres full-text + trigram) to find relevant items, and runs the deterministic rule-based solver to assemble outfits within a budget. |
Safety Gate ( |
Two-layer LLM guardrail service — input speculation (parallel guard + generation) and visible output rollback — validating every user message and assistant reply. |
Session Store ( |
Conversation state, shopping-cart contents, and session persistence. |
ChromaDB |
Vector database storing product catalog embeddings for |
PostgreSQL |
Relational database backing |
Redis |
Best-effort cache of recent chat messages for |
LLM |
Large Language Model served via vLLM; used by |
VLM |
Vision-language model used for image-based product search (default: mistralai/Mistral-Small-3.2-24B-Instruct-2506). |
Embedding Model |
Generates text embeddings for semantic product search, CPU only (default: intfloat/multilingual-e5-large-instruct). |
CLIP Model |
Generates image embeddings for visual product search, CPU only (default: openai/clip-vit-large-patch14). |
Key Features#
Hybrid search: conversational product search combining text and image queries via hybrid fusion across five ranked sources (e5 text embeddings, CLIP image-to-text, CLIP image-to-image, Postgres full-text, and Postgres trigram search), merged with Reciprocal Rank Fusion.
Context-aware routing: the router classifies each turn using a short recent-history window plus session state (last shown results, pending bundle, active cart focus), so refinements and follow-ups stay in context instead of resetting the search on every turn.
Natural-language cart operations: add/remove by ordinal, quantity, or superlative, executed deterministically, with a clarifying question when a reference is ambiguous.
AI stylist / outfit bundle builder (example bundle functionality): assembles a complete look within budget using a deterministic, rule-based compatibility solver in
product-search— the LLM only classifies the request and phrases the reply, it does not pick the items itself. Outfit slots, category compatibility, and role-conflict rules live in a human-editablebundle_rules.md, not in code. Supports swap, drop, augment, anchor, and budget increases on request.Catalog grounding: products shown and cart totals are drawn from the real catalog and cart state rather than generated by the LLM.
Two-layer safety gate: input speculation running in parallel with generation, plus a visible output rollback if a violation is caught after the fact — powered by the same LLM already serving the conversation, not a separate guard model.
Real-time streaming: assistant replies and product cards streamed to the frontend over Server-Sent Events (SSE).
Session and cart persistence: state persists across turns via PostgreSQL, with Redis as a best-effort cache of recent chat messages (cart state is always read/written directly against PostgreSQL).
Getting Started#
This is a quick start guide on how to deploy the blueprint. For advanced options, such as reusing an existing AMD Inference Microservice (AIM), providing a Hugging Face token, or overriding storage classes, see Deploying Solution Blueprints with Helm. For blueprint specific details such as connecting to existing LLM/VLM endpoints, HTTPRoute configuration, and secret management, see the advanced deployment guide.
Prerequisites#
System Requirements#
This blueprint can be deployed on AMD Instinct. The blueprint requires the following cluster resources by default:
Resource |
Default Configuration |
|---|---|
GPUs |
2 |
CPUs |
18 CPU cores |
RAM |
398 GiB |
To deploy to the Kubernetes cluster, ensure the following prerequisites are met:
Infrastructure#
Kubernetes cluster with GPU-capable worker nodes.
Persistent storage for ChromaDB and PostgreSQL.
Network configuration that allows client access to the frontend endpoint (HTTPRoute/Gateway API, or port-forwarding for local testing).
Self-Hosted AI Models#
This blueprint requires 2 AMD GPUs to start:
llm— Qwen3-32B (routing, response generation, summarization, and safety-gate checks).vlm— Mistral-Small-3.2-24B-Instruct (image understanding for photo-based search).
Text and image embedding models run on CPU only — no additional GPU required:
embedding— multilingual-e5-large-instruct (text embeddings).clip— CLIP ViT-L/14 (image embeddings).
If you use llm.existingService and/or vlm.existingService, GPU requirements are defined by those
external services instead.
Deployment#
Create the credentials Secret#
Before deploying, create a Kubernetes Secret with the Postgres and Redis credentials:
namespace="my-namespace"
kubectl create namespace $namespace
POSTGRES_ADMIN_PASSWORD=$(openssl rand -base64 24)
POSTGRES_PRODUCT_SEARCH_PASSWORD=$(openssl rand -base64 24)
REDIS_PASSWORD=$(openssl rand -base64 24)
kubectl create secret generic retail-assistant-credentials -n $namespace \
--from-literal=postgres-admin-password="$POSTGRES_ADMIN_PASSWORD" \
--from-literal=postgres-product-search-password="$POSTGRES_PRODUCT_SEARCH_PASSWORD" \
--from-literal=redis-password="$REDIS_PASSWORD"
See Create the credentials Secret in the deployment guide for what each key is used for, and how to use a different Secret name.
Deploy#
name="my-deployment"
namespace="my-namespace"
helm template $name oci://registry-1.docker.io/amdenterpriseai/aimsb-retail-shopping-assistant \
| kubectl apply -f - -n $namespace
To check the status of the deployment, run:
kubectl get pods -n $namespace
Wait until all pods report Running and Ready.
Connect to the UI#
To access the UI, port-forward the frontend service and open http://localhost:3000 in your browser.
kubectl port-forward "svc/aimsb-retail-shopping-assistant-$name-frontend" 3000:3000 -n $namespace
Clean Up#
When you are finished, remove the deployed resources using the same deployment command, with
kubectl delete instead of kubectl apply:
helm template $name oci://registry-1.docker.io/amdenterpriseai/aimsb-retail-shopping-assistant \
| kubectl delete -f - -n $namespace
Usage#
Product Search#
Ask for products in plain language or upload a photo. The router fuses dense text/image embeddings with Postgres full-text and trigram search, catching exact wording and typos that embeddings alone can miss, so follow-ups like “something like this, but darker” resolve against the same result set rather than starting a new search.
User: show me something for a beach day
Agent: Any particular color you're looking for, or should I just show you the best matches?
User: best matches
Agent: Here are some great options for a beach day:.....
Cart Operations#
Add, remove, or view cart items by talking naturally — ordinals (“the first one”),
quantities (“make it 5”), and superlatives (“the cheapest one”) all resolve deterministically.
undo reverts the last cart action. The assistant asks a clarifying question when a reference
is ambiguous; every total it quotes comes directly from the cart snapshot.
User: add the cheapest one to my cart
Agent: Added One-Piece Swimsuit (58 USD) to your cart...
User: actually, make it 2
Agent: Set One-Piece Swimsuit to 2. Here's your cart....
User: undo that
Agent: Done — I've reverted that. Here's your cart:....
AI Stylist (Outfit Bundles)#
Ask for a complete outfit within a budget. The LLM’s role here is limited to classifying the request and turning the solver’s output into a natural-language reply — it does not choose the items itself. The actual assembly happens in a deterministic, rule-based solver. At startup, the service builds an in-memory index of the catalog and loads outfit rules from
product_search/catalog/bundle_rules.md — a
human-editable file, not code — which defines the outfit “slots” (e.g. top, bottom, shoes,
accessory), which categories are appropriate for which occasion, and how to resolve conflicts
between items that would fill the same slot.
Given a budget and any constraints (occasion, anchor item, style), the solver searches the catalog index for a combination of items — one per required slot — that fits the budget and clears a minimum coherence-score threshold for stylistic consistency, then hands the result back to the LLM to phrase. Because catalog matching and budget math happen entirely at the algorithm level, recommendations are drawn from actual, in-budget catalog items, and stylists or domain experts can tune the outfit logic by editing bundle_rules.md without touching code.
This is an example implementation. It is intended to show how a bundle solver can be wired into a conversational assistant, not to be a production-ready merchandising engine.
What it supports:
Anchor — build a look around an item already in the cart.
Swap — replace one piece in the bundle.
Drop — remove a piece with no replacement.
Augment — add another item to the bundle.
Budget change — re-solve the bundle against a higher budget.
User: put together an office look for $300
Agent: Here's a complete office look ......
Known limitations:
Budget can only be raised, not lowered. To start fresh at a lower price point, begin a new bundle request.
Occasion profiles and slot rules are fixed in
bundle_rules.md. Items outside the defined slots (e.g. swimwear in an office look) are not allowed.One item per slot. Asking to add a second item of a type already in the look is not allowed.
The anchor item (the cart item the look is built around) cannot be swapped via a follow-up request — it must be removed from the bundle first.
How the Solver Works#
Checking every possible combination of catalog items would be computationally infeasible, so the solver splits each outfit into a small “core” — top + bottom + shoes, a dress + shoes, or swimwear + shoes — plus an “add-on” layer of accessories filled in afterward.
Item passport (built once, at startup). Every catalog item is tagged with a slot, a formality score, a mood, a color family, and a print-loudness flag, derived from its category and description. Pairwise compatibility between items is precomputed from mood, formality, and color agreement, plus any “goes well with” relationships already called out in the catalog.
Exact core search. The solver checks every valid core combination allowed by the occasion that fits the budget, and scores each on item quality plus pairwise compatibility. Since a core has only a handful of slots, this space is small enough to search exhaustively, finding a strong core rather than relying on approximation.
Greedy accessory fill. Starting from the best core, accessories are added one at a time — whichever gives the largest score improvement within the remaining budget — until nothing more helps.
Coherence gate. Alongside the overall score, which includes price, the solver also computes a style-only coherence score. If the best budget-feasible option doesn’t clear this threshold, the solver declines to return it rather than confidently presenting a stylistically poor match.
Diverse alternatives. When multiple options are requested, near-duplicate outfits are filtered out so the choices offered are meaningfully different from one another.
Scoring, from bundle_rules.md
Compatibility is scored through a set of weighted rules that reward items the catalog styles
together or that share a mood, and penalize mismatched formality, clashing moods, clashing colors,
or stacking multiple loud prints. Price contributes to the score on a diminishing basis, so an
expensive item can’t buy its way to a high score simply by costing more. All of these weights live
in bundle_rules.md, not in code, and a separate coherence threshold — independent of price —
decides whether a bundle is stylistically good enough to offer at all.
Structure of bundle_rules.md
The file is the single source of truth for the solver’s domain knowledge; nothing is hardcoded in Python. It defines:
Which catalog categories map to which outfit slot, and keyword-based overrides.
Formality scoring by category, adjusted by keywords in the item text.
Color families, and which prints count as “loud.”
Hard constraints the solver enforces structurally (one pair of shoes, no duplicate accessory slots, budget never exceeded, and similar).
The weighted compatibility rules, and which moods and colors clash with each other.
Occasion presets — required/optional/forbidden slots and the allowed formality range — along with a per-occasion mood bonus.
Scoring presets for different shopping objectives (value / balanced / statement).
Guardrails (Safety Gate)#
Messages and replies are routed through safety-gate twice: an input check that runs in parallel
with generation (no added latency on the happy path), and an output check that can visibly roll
back a reply if a violation is caught after generation. It is designed to catch
prompt-injection/jailbreak attempts and fabricated policy claims, with override rules to reduce
false positives on ordinary shopping behavior (large orders, price questions, budget increases).
Model Compatibility#
This Blueprint has been validated with:
LLM: Qwen3-32B
VLM: Mistral-Small-3.2-24B-Instruct
Prompts, the router, the cart agent, and the safety-gate have been tuned and tested for this class of models. Using smaller or less capable models may lead to routing errors, unstable structured output, or guardrail false positives/negatives; additional prompt or configuration tuning may be necessary in that case.
Embedding: multilingual-e5-large-instruct (text, CPU)
CLIP: CLIP ViT-L/14 (image, CPU)
Third-Party Components#
This Solution Blueprint utilizes multiple components. For third-party license information, refer to each component’s documentation. Key third-party components are listed below.
Component |
License |
|---|---|
FastAPI |
MIT |
LangGraph |
MIT |
ChromaDB |
Apache 2.0 |
PostgreSQL |
PostgreSQL License |
Redis |
BSD-3-Clause |
Pydantic |
MIT |
The blueprint also relies on AMD Inference Microservices (AIMs) for the default LLM and VLM backends. These are governed by their respective model and image licenses; see the catalog of available AIMs.
Terms of Use#
AMD Solution Blueprints are released under the MIT License, which governs the parts of the software and materials created by AMD. Third-party Software and Materials used within the Solution Blueprints are governed by their respective licenses.