Overview
The AI Product Categorizer is a web-based tool that parses MX item names into clean, export-ready fields such as brand, item name, Kind of Product, size, UOM, container, pack, age, year, and flavor. It supports multiple output formats (Output 1, 1.1, and Output 2 templates) and can run on Alcohol, CNG, CBD, and CAN inputs using the same engine. Batch Mode focuses on throughput and multi-format exports; Review Mode focuses on strict rules, validation, and prompt-level debugging.
My Role
- Designed the full parsing ruleset for Alcohol, CNG, CBD, and CAN domains.
- Implemented the Flask blueprints, GPT-4o-mini integration, and chunked processing logic.
- Built Output 1 / 1.1 / 2 pipelines, including template schemas for different export formats.
- Integrated MySQL logging for user activity, token usage, and Brand Path / Category Path enrichment.
- Created two UIs: Batch Mode (Beast Mode) with multi-output toggles, and Review Mode (God Mode) with a debugging-focused layout.
Tech Stack
- Backend: Python, Flask blueprints, OpenAI GPT-4o-mini, Pandas, MySQL.
- Prompting: external prompt files (Beast & God Mode) and allowed Kind of Product lists.
- Frontend: HTML/CSS, custom JS table renderer, multi-output toggles, dark-mode UI for Review Mode.
- Infrastructure: Linux VPS (Hostinger), Nginx, Gunicorn, file-based logging under
/tmp.
Two Modes, Same Engine
Batch Mode (Beast Mode) – High-Throughput Categorizer
- Chunked GPT calls (up to 16 lines per request) with automatic retry and single-line fallback.
- Generates Output 1 (raw GPT), Output 1.1 (enriched with Brand Path & Category Path), and Output 2.
- Dynamic Output 2 template schemas for Alcohol, CNG, CBD, CAN CNG, and CAN Alcohol formats.
- Accent-insensitive item lookups, container normalization, and copy-to-clipboard buttons for all outputs.
- UI lets users switch Output 2 format via dropdown without re-running GPT.
Review Mode (God Mode) – Precision & Debugging
- Uses a stricter prompt with an allowed Kind of Product list to prevent generic or vague KOP values.
- Cleans Item Name by removing brand, size, unit, and container words, then re-normalizing.
- Reuses the same container hallucination guard as Batch Mode, logging any fixes or removals.
- Dark UI focused on reviewing rows, timing, and OIN process counts for debugging runs.
- Logs full prompts, replies, and token usage to help refine rules and manage cost.
Key Features
- Strict schema enforcement: every row outputs exactly 12 fields in a fixed order, ready for downstream Excel / SQL.
- Container hallucination firewall: only sets Bottle/Can/Box/Pouch/Jar/Keg when the term appears as a whole word in the product name.
-
L vs ml enforcement:
keeps liter sizes exactly as written (e.g.,
1.75L→1.75+L), never silently converting to milliliters. - Brand & category enrichment: joins against Brand Path and Category Path data, then builds multiple export layouts from the same GPT output.
- Cost-aware logging: writes user email, action, prompt tokens, completion tokens, total tokens, and cost into MySQL for tracking.
Impact
The dual-mode setup lets teams choose between speed and precision without switching tools. Batch Mode handles day-to-day batch categorization and export, while Review Mode is used for tricky edge cases, rules tuning, and QA investigations. Together, they replace manual spreadsheet parsing and reduce per-line categorization work from minutes to seconds, while keeping outputs structured enough to plug directly into existing Alcohol, CNG, CBD, and CAN workflows.
Demo
🎥 Demo Coming Soon
Video walkthroughs for Batch Mode (multi-output) and Review Mode (debug view) will be uploaded soon. For now, you can preview the tool live inside the internal categorizer environment.