Product Attribute Extractor
Pull structured attributes such as brand, colour and size out of product titles, using an LLM.
#about
Turns product titles or descriptions into structured attributes such as brand, colour, voltage, material and size, with one column per attribute.
Any OpenAI-compatible model works (OpenAI's GPT Luna by default, with GPT Terra as the stronger option), and changing the base URL lets you use a local LLM.
Attribute names build up across the catalogue: the model sees the names found so far and reuses them before creating new ones, which keeps naming consistent.
Each product is one API call.
Run it locallyAPI key or local model
- Platform
- Streamlit app you run on your own machine (needs Python 3.x)
- Input
- CSV containing product titles or descriptionsAPI key (OpenAI or compatible provider)Model name (default: gpt-6-luna; gpt-6.1-terra on OpenAI, or your local server's model name)Base URL (changeable for local LLMs)
- Output
- Enriched CSV with original product text plus one column per discovered attribute (brand, colour, voltage, material, size, product_type, etc.), sorted so the most populated attributes appear first.
- Category
- E-commerce
Use cases
- Product data enrichment and normalisation at scale
- Faceted navigation planning from unstructured titles
- Product feed optimisation for Google Shopping
- Structured data preparation for schema markup
#features
- Iterative attribute discovery (known set grows with each product)
- Few-shot examples for consistent extraction quality
- Enforces lowercase_with_underscores for attribute keys
- Always infers product_type even when not explicit
- JSON response format for reliable parsing
- Columns sorted by population frequency in output
- Supports OpenAI, Azure OpenAI, or any local LLM with compatible API
- Default model: GPT Luna, with GPT Terra as the stronger OpenAI option
#how-to-use
- Enter your API key in the sidebar
- Optionally set a custom base URL for local LLMs
- Upload a CSV and select the product text column
- Click Extract Attributes and monitor progress
- Review discovered attribute count as it grows
- Download the enriched CSV with one column per attribute
#faq
- How does the iterative attribute discovery work?
- The tool maintains a set of attribute names discovered so far. For each product, the system prompt includes the sorted known attribute list and instructs the model to reuse those names where applicable before inventing new ones. After each response, any new attribute keys are added to the known set and appear in subsequent prompts. This means attribute consistency improves as processing progresses.
- What format are the attribute keys in the output?
- All attribute keys are normalised to lowercase_with_underscores. The validate_and_clean_attributes function strips whitespace, lowercases, and replaces spaces with underscores. Duplicate keys after normalisation keep only the first non-empty value.
- What happens when the model cannot extract any attributes?
- If the API call fails entirely (network error, timeout, rate limit), an empty dict is returned for that row and an error is logged. If the model returns JSON but omits product_type, the code forces product_type to 'unknown' before returning. The row will have empty cells for all other attribute columns in the final CSV.
- Can I use a local LLM instead of OpenAI?
- Yes. Change the Base URL in the sidebar to your local server (e.g. http://localhost:1234/v1 for LM Studio, or http://localhost:11434/v1 for Ollama). The tool uses the OpenAI client library and JSON response format, so the local model must support the /v1/chat/completions endpoint with response_format json_object.
- Why are output columns sorted by frequency?
- The sort_columns_by_frequency function counts non-null values per column and reorders so the most populated attributes appear first. This means universally applicable attributes like brand and product_type appear on the left, while rare attributes (specific to a few products) move to the right, making the CSV easier to scan.
- How many products can it handle in one run?
- There is no hard limit in the code. Products are processed one at a time sequentially with no batching, so runtime scales linearly. A progress bar shows position and the number of discovered attributes. For large catalogues, cost is one API call per product row at the rates of the model you choose (GPT Luna is the default and the lower-cost OpenAI option).
/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.