Lee Foot

Review Tagger

Tag customer reviews with a one or two-word topic label using OpenAI GPT models in batches.

View the source

#about

Sends reviews to the OpenAI API in configurable batches (default 25 per call) using JSON response format.

The model assigns a one or two-word descriptive tag capturing the primary topic of each review (e.g.

"Delivery", "Build Quality", "Sizing", "Value").

Includes retry logic with exponential back-off (3 retries, 5-second delay) and progress tracking.

Reviews that fail to tag are left blank for manual review.

Pairs with the Tag Consolidator tool for grouping granular tags into broader categories.

Requires an API key

Platform
Python script (requires Python 3.x)
Input
CSV with a column containing review textOpenAI API key
Output
Original CSV with a new Tag column containing one or two-word topic labels per review. Summary metrics: total tagged, successfully tagged, unique tags, and untagged count.
Category
Content

Use cases

  • First-pass review classification before deeper analysis
  • Identifying recurring product issues from customer feedback
  • Grouping reviews by topic for sentiment reporting
  • Feeding into the Tag Consolidator for higher-level categories

#features

  • Batch processing with configurable size (5-100, default 25)
  • JSON response format for reliable parsing
  • Retry logic with exponential back-off (3 retries, 5s delay)
  • Model selection: gpt-4o-mini (default), gpt-4o, gpt-4.1
  • Automatic review column detection (default: Review)
  • Failed tags left blank with summary counts for manual review
  • Progress tracking with batch counter

#how-to-use

  1. Enter your OpenAI API key in the sidebar
  2. Choose a model (gpt-4o-mini recommended for cost)
  3. Upload your CSV and select the review text column
  4. Adjust batch size if needed (default 25)
  5. Click Tag Reviews and monitor progress
  6. Download the results CSV with the new Tag column

#faq

How are reviews sent to the API and what format comes back?
Reviews are batched (default 25 per call). Each review in the batch is sent as a separate user message containing a JSON object with an ID (the DataFrame row index) and the review text. The model is instructed to return a single JSON object mapping each ID to a one or two-word tag. The response_format is set to json_object for reliable parsing.
What happens when a review cannot be tagged?
If the model omits an ID from its response, or if the entire API call fails after 3 retries (5-second delay between attempts), the Tag column for those rows is left as NA. The app displays a warning with the untagged count so you can review them manually or re-run.
Can a review receive more than one tag?
No. The system prompt explicitly instructs the model to choose the single most dominant topic and return exactly one tag of one or two words. If a review spans multiple topics, only the primary one is captured. For broader categorisation, pair this tool with the Tag Consolidator.
How does batch size affect cost and quality?
Larger batches mean fewer API calls (lower per-call overhead) but more tokens per request because all reviews in the batch are included as messages. Quality can degrade with very large batches if the model loses track of IDs, though the JSON response format helps. The default of 25 balances cost and reliability.
What models are available and which should I choose?
The Streamlit app offers gpt-4o-mini, gpt-4o, and gpt-4.1 in a dropdown. The CLI reads from the OPENAI_API_KEY environment variable and defaults to gpt-4o-mini. For most review tagging, gpt-4o-mini is recommended: it produces equally good one-word tags at a fraction of the cost of larger models.

/contact

Want me to run this for you? I run this tool as a managed service, or build something custom around your data. You get the insights without touching the code.