How 522blackcat/appleproductrag works
AppleProductRag builds a local FAISS index from Apple product Markdown, then answers user queries through constrained vector retrieval, reranking, and an LLM. The map includes the documented year/month/color/category filters and product metadata (including prices, images, and document paths). Source excerpts establish the main calls; the documented workflow supplies the fallback behavior. Product-document maintenance scripts are omitted as supporting utilities.
Main entry points: search_index.py Query workflow · build_index.py Index builder · rag_common.py Embedding model · faiss_index FAISS index
Components 13
Product corpus and index
- Product documents
docs - Index builder
build_index.py - Embedding model
rag_common.py - FAISS index
faiss_index
Query and retrieval
- Query workflow
search_index.py - Constraint parser
search_index.py - Rule filter
search_index.py - Fallback candidates
search_index.py
Ranking and answer
- ColBERT reranker
rag_common.py - Answer context
search_index.py - DashScope Qwen
- Answer and product details
search_index.py
Other components
- User
Connections 14
- Product documents → Index builder: reads Markdown
build_index.py - Index builder → Embedding model: creates embeddings
build_index.py - Index builder → FAISS index: writes index
build_index.py - User → Query workflow: submits query
README.md - Query workflow → Constraint parser: parses constraints
search_index.py - Query workflow → Embedding model: creates embeddings
search_index.py - Query workflow → FAISS index: loads and searches
search_index.py - Query workflow → Rule filter: filters candidates
search_index.py - Query workflow → Fallback candidates: selects Top 8
README.md - Query workflow → ColBERT reranker: reranks candidates
search_index.py - Query workflow → Answer context: builds prompt context
search_index.py - Query workflow → DashScope Qwen: invokes model
search_index.py - Answer context → DashScope Qwen: supplies prompt
search_index.py - Query workflow → Answer and product details: prints answer and details
search_index.py