Skip to content

Latest commit

Β 

History

111 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›οΈ Amazon Fashion Product Intelligence System

An end-to-end Retrieval-Augmented Generation (RAG) application that enables Product Managers, Brand Managers, Category Managers, and E-commerce Analysts to explore Amazon Fashion products using natural language instead of manually analyzing thousands of product listings and customer reviews.

The system combines Hybrid Retrieval (Dense + BM25), Large Language Models, Monitoring, and Evaluation to generate accurate, grounded answers from Amazon Fashion product data.


🎯 Business Problem Product managers and brand managers often need to analyze hundreds of product listings and thousands of customer reviews to understand customer sentiment, compare competitors, identify product strengths and weaknesses, and make pricing or merchandising decisions. Manual analysis is time-consuming and difficult to scale.

The Amazon Fashion Product Intelligence System addresses this challenge by combining Retrieval-Augmented Generation (RAG) with hybrid search to provide accurate, evidence-grounded answers from product metadata and customer reviews using natural language.

✨ Project Highlights

  • End-to-End Production-style RAG Pipeline
  • Hybrid Retrieval (Dense Embeddings + BM25 + Reciprocal Rank Fusion)
  • Semantic Search using Sentence Transformers
  • Chroma Vector Database
  • Gemini-powered Answer Generation
  • Modular & Maintainable Architecture
  • Prompt Strategy Framework
  • LLM-as-a-Judge Evaluation
  • Monitoring Dashboard with Telemetry Metrics
  • Interactive Streamlit Chat Interface

βœ… Evaluation Criteria Mapping

This project was developed following the LLM Zoomcamp evaluation rubric. The table below maps each evaluation criterion to its implementation in this repository.

Evaluation Criterion Score Repository Location Description
Problem Description βœ… 2/2 README.md Clearly defines the business problem and target users (Product Managers, Brand Managers, Category Managers, and E-commerce Analysts).
Retrieval Flow βœ… 2/2 src/pipeline/
src/retrieval/
src/vector_store/
src/context_builder/
src/llm/
Complete Retrieval-Augmented Generation (RAG) pipeline combining a knowledge base with Google Gemini for grounded answer generation.
Retrieval Evaluation βœ… 2/2 src/retrieval/
src/evaluation/ground_truth/
src/evaluation/evaluator/
Evaluates Dense Retrieval, BM25 Retrieval, and Hybrid Retrieval (Reciprocal Rank Fusion), selecting the best-performing approach.
LLM Evaluation βœ… 2/2 src/evaluation/llm/ Compares multiple prompt strategies and evaluates generated answers using an LLM-as-a-Judge evaluation framework.
Interface βœ… 2/2 ui/app.py
ui/components/
Interactive Streamlit application for natural language querying of Amazon Fashion products.
Ingestion Pipeline ⚠️ 1/2 src/scripts/preprocess_data.py
src/indexing/run.py
Automated preprocessing and indexing through Python scripts. No orchestration framework (Airflow, Prefect, dlt, etc.) is used.
Monitoring ⚠️ 1/2 src/monitoring/
ui/monitoring.py
Telemetry collection and interactive monitoring dashboard with multiple visualizations.
Containerization ❌ 0/2 β€” Docker support is not included.
Reproducibility βœ… 2/2 README.md
pyproject.toml
config/
Complete setup instructions, dependency management using uv, configuration files, and execution commands are provided.

⭐ Best Practices

Best Practice Status Repository Location
Hybrid Search (Dense + BM25 + Reciprocal Rank Fusion) βœ… src/retrieval/
Document Re-ranking ❌ Not Implemented
User Query Rewriting ❌ Not Implemented

Note: This table is a self-assessment based on the published LLM Zoomcamp evaluation rubric. Final scoring is determined by the project reviewers.


πŸ—οΈ System Architecture

System Architecture


πŸ“‚ Repository Structure

amazon-product-intelligence/
β”‚
β”œβ”€β”€ config/                 # Application configuration
β”‚
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ raw/                # Original dataset
β”‚   β”œβ”€β”€ processed/          # Cleaned dataset
β”‚   └── chroma/             # Vector database
β”‚
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ architecture/       # System diagrams
β”‚   └── adr/                # Architecture decisions
β”‚
β”œβ”€β”€ outputs/
β”‚   β”œβ”€β”€ evaluation/         # Evaluation reports
β”‚   β”œβ”€β”€ monitoring/         # Telemetry logs
β”‚   └── ground_truth/       # Generated benchmark dataset
β”‚
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ preprocessing/      # Data cleaning pipeline
β”‚   β”œβ”€β”€ document_builder/   # Product document generation
β”‚   β”œβ”€β”€ chunking/           # Document chunk creation
β”‚   β”œβ”€β”€ embeddings/         # Embedding generation
β”‚   β”œβ”€β”€ indexing/           # Knowledge base indexing
β”‚   β”œβ”€β”€ retrieval/          # Hybrid retrieval engine
β”‚   β”œβ”€β”€ context_builder/    # Context assembly
β”‚   β”œβ”€β”€ prompt_builder/     # Prompt construction
β”‚   β”œβ”€β”€ llm/                # Gemini integration
β”‚   β”œβ”€β”€ pipeline/           # End-to-end RAG workflow
β”‚   β”œβ”€β”€ monitoring/         # Telemetry collection
β”‚   β”œβ”€β”€ evaluation/         # Retrieval & LLM evaluation
β”‚   β”œβ”€β”€ scripts/            # Utility & setup scripts
β”‚   └── vector_store/       # ChromaDB management
β”‚
β”œβ”€β”€ ui/
β”‚   β”œβ”€β”€ app.py              # Chat application
β”‚   └── monitoring.py       # Monitoring dashboard
β”‚
└── README.md               # Project documentation

βš™οΈ Quick Start

Clone the Repository

git clone <repository-url>
cd amazon-product-intelligence

Install Dependencies

uv sync

Configure Environment Variables

Create a .env file.

GEMINI_API_KEY=YOUR_GEMINI_API_KEY

1. Preprocess the Dataset

python -m src.scripts.preprocess_data

This cleans and standardizes the raw Amazon Fashion dataset.


2. Build the Vector & BM25 Indexes

python -m src.indexing.run

This:

  • Generates product documents
  • Chunks documents
  • Creates embeddings
  • Builds the Chroma vector database
  • Builds the BM25 index

Note: This step only needs to be run once or whenever the dataset changes.

4. Launch the Chat Application

PYTHONPATH=. uv run streamlit run ui/app.py

5. Launch the Monitoring Dashboard

PYTHONPATH=. uv run streamlit run ui/monitoring.py

Evaluation

Generate Ground Truth

python -m src.evaluation.ground_truth.run

Run LLM Evaluation

python -m src.evaluation.llm.run

Generate Evaluation Report

python -m src.evaluation.evaluator.run

πŸ“š Documentation

Document Description
docs/architecture/system-architecture.png Complete system architecture
docs/architecture/system-design.md High-level design and component interactions
docs/architecture/rag-pipeline.md End-to-end RAG pipeline workflow
docs/adr/ADR-001-Hybrid-Retrieval.md Architectural Decision Record for Hybrid Retrieval
docs/adr/ADR-002-Embedding-Model.md Embedding model selection rationale

πŸ› οΈ Technologies

Programming

  • Python 3.12

LLM

  • Google Gemini

Embeddings

  • Sentence Transformers
  • BAAI/bge-small-en-v1.5

Retrieval

  • ChromaDB
  • BM25
  • Reciprocal Rank Fusion

User Interface

  • Streamlit

Data Processing

  • Pandas
  • NumPy

Monitoring & Visualization

  • Plotly
  • Streamlit Dashboard

Evaluation

  • LLM-as-a-Judge
  • Prompt Strategy Evaluation

Development

  • uv
  • Git
  • VS Code

About

An end-to-end Retrieval-Augmented Generation (RAG) system that helps Product Managers, Brand Managers, and E-commerce Analysts explore Amazon Fashion products and customer reviews through natural language, powered by hybrid retrieval and Google Gemini.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages