Draft write-up
A personal stylist you talk to in plain English. Describe an occasion, point at a garment, or share an outside photo, and the system returns complete, wearable outfits assembled only from items in the wardrobe. The language model is never allowed to invent clothing: the engine retrieves real items first, asks the model to compose outfits strictly from those, and validates every outfit in code before it is shown.
01Problem
A language model asked to style an outfit will happily recommend clothes you do not own. For a wardrobe assistant that makes every answer useless. The task needed retrieval over the real closet, outfit rules the model cannot break, and memory so follow-ups like "smart clean look" attach to the earlier request.
02Approach
- 01
Understand the request
A language model turns the raw message into structured intent: occasion, vibe, item id, image path and whether a follow-up question is needed. A rule-based layer repairs edge cases and stops stale conversation context from leaking into a fresh request.
- 02
Remember the session
Per-session memory merges new information with earlier turns, so a short follow-up attaches to the right occasion.
- 03
Retrieve with hybrid search
For the chosen garment, compatible candidates are pulled per role (top, bottom, outerwear) by combining semantic embeddings in pgvector, a metadata bonus for color and style, and BM25 keyword scoring.
- 04
Compose, then validate in code
The model assembles three outfits (minimal, layered, alternative) strictly from the retrieved item identifiers. Incomplete or rule-breaking outfits are removed in code instead of being trusted to the model, and two more calls write the intro and a final stylist note.
03Architecture
A retrieval-first pipeline: the model parses and composes, but the closet, the rules and the final check all live outside the model.
01Message
Text, item id or outside photoThree ways in: describe an occasion, style a specific garment, or pair an outside photo with the wardrobe.
02Query understanding
LLM + rule repairStructured intent, with rules that fix edge cases and block stale context.
03Chat memory
Session contextOccasion, vibe, item id, image and history carried across turns.
04Hybrid retrieval
pgvector + metadata + BM25Cosine similarity on embeddings, a color and style bonus, then exact keyword reranking.
05Outfit composer
GPT-4.1-miniThree outfits built only from retrieved identifiers, following hard pairing rules.
06Validation
CodeOutfits that are incomplete or break the rules are dropped before display.
- Three full outfits per request, each with a reason, styling notes and a confidence level
- Style around one specific garment, with alternatives from similar items already owned
- Outside photos are captioned and embedded with CLIP, then treated as a temporary garment
- "Find similar items" through CLIP image similarity
04Challenges
The model could recommend clothes that are not in the wardrobe.
FixRetrieval comes first, composition uses only retrieved identifiers, and every outfit is validated in code.
Old conversation context leaked into new requests.
FixPer-session memory merges follow-ups deliberately, and a rule-based layer resets context for a fresh request.
05Learnings
Outcomes
- A working RAG pipeline for fashion with grounded, validated outfits
- Every recommendation carries a reason, styling notes and a confidence level
- A written production and scaling roadmap in the repository
What I learned
- Do the checking in code. A prompt asking the model to behave is not a guarantee.
- Hybrid retrieval keeps exact attributes that embeddings alone blur.
06Next
- 01Follow the production and scaling roadmap in the repository
- 02Add an offline evaluation set of requests with expected outfits
