Each item's prompt contains the seller's whole rating list and whole listing list, because the profile scraper scrolls until the site says there is no next page.
Every entry also carries fields the criteria never use (rating id, rating image URLs, listing id, listing image URL, the seller avatar URL), and the JSON is pretty-printed with indent=2.
- What to change
- Where the prompt JSON is built, drop the id and URL fields from the seller lists, serialise compactly, and optionally cap the lists to the newest N entries (a setting, default unlimited so answers do not change).
- Why it matters
- Seller entries are about 100 tokens each, about half of it ids, URLs and indentation. The block is sent again for every item of the same seller, because only the scraping is cached (SellerProfileCache), not the prompt.
- How big it is
- The code shows the problem and how often it happens; how many tokens it costs each time is assumed. To measure it: prompt_tokens of one analysis request (provider usage) for an item whose seller has about 40 ratings and 40 listings, before and after the change
- Estimate
- about 3.5M prompt tokens per 1,000 items (estimate)
What the estimate assumes
A seller with 40 ratings and 40 listings (the size in the project's own log in issue 146), about 100 tokens per entry, about 45 percent of it ids, URLs and whitespace; the average call is about 20,000 prompt tokens (up to 9 images, the seller block, about 3,000 tokens of instructions, the item JSON). Larger sellers cost proportionally more; the cap would be a separate, optional change.