Inspiration

Modern e-commerce search requires navigating ambiguous, evolving shopper intent across multi-turn interactions. Shoppers often start with broad concepts, disclose requirements gradually, or modify their preferences mid-conversation.

We set out to build Shop It All Here (SIAH), a conversational shopping agent engineered around deterministic dialogue state tracking, fast in-memory full-text search, and adaptive candidate re-ranking to efficiently guide users to their target product within 10 turns.

What it does

SIAH acts as an autonomous conversational shopping assistant that searches across a catalog of 50,000 products:

Active Preference Elicitation: Strategically asks open-ended clarification questions during early turns to gather broad user requirements before narrowing down to specific product attributes.

Dual-Tier Query Retrieval: Combines strict category-level boolean filtering (AND) with broad attribute matching (OR), featuring automatic fallback handling to ensure relevant candidates are always returned.

Non-Destructive Override Management: Gracefully accommodates mid-dialogue preference changes (e.g., "Actually, ignore my earlier preference...") by selectively updating conflicting attributes while preserving previously established context.

Coverage-Based Re-ranking: Re-scores retrieved items against accumulated conversational terms and structured metadata fields to prioritize exact-match products in the scored Top 10.

How we built it

Pure Python, Zero Costs: Built entirely with Python’s standard built-in tools (sqlite3, re, json). It requires no third-party libraries, cloud databases, or paid API keys.

Instant In-Memory Search: Loads the entire 50,000-product catalog directly into RAM on startup using SQLite’s built-in Full-Text Search (FTS5). This allows the engine to return results in milliseconds.

Keyword Matching via Hardcoded Lists: Scans user messages against hand-built dictionaries for specific attributes (colors, materials, sizes, styles, and use cases) and uses regular expressions to capture brand names and categories.

Flexible Two-Step Search: Enforces a strict match on the product category (AND) while flexibly matching descriptive keywords (OR). If a strict search returns zero items, it automatically falls back to a broader search so the user never sees an empty screen.

Smart Mind-Change Handling: When a user changes their mind mid-conversation (e.g., "Actually, I want silk instead of cotton"), it only replaces that specific slot, keeping the rest of their conversation history and preferences intact.

Match-Count Re-Ranking: Takes the top candidates found by the search engine and scores them based on how many extracted user preferences appear in the product description, pushing the closest overall matches straight into the Top 10.

Challenges we ran into

Without much prior hackathon experience, manually compiling lists for materials, colors, styles, and use cases across 50,000 products was tough. We had to spend a lot of time tweaking our keyword lists so our code wouldn't miss obvious descriptions.

When the agent failed to find the right item within 10 turns, it was hard to tell whether the search query was bad, the clarifying question was unhelpful, or the ranking was off. Going through individual chat logs to pinpoint where things went wrong was a steep learning curve.

When a user changed their mind mid-conversation (e.g., "Actually, ignore what I said earlier..."), our initial code wiped the entire conversation history. We had to rewrite the state tracker so it only updated the changed preference while keeping the rest of the details.

Accomplishments that we're proud of

Built an end-to-end search agent using only built-in Python and SQLite FTS5, making it completely self-contained and able to return results in milliseconds.

Successfully handled tricky changes of mind (intent overrides) without accidentally wiping out the rest of the conversation history.

What we learned

Asking open-ended questions early in the conversation uncovers far more useful details in a single turn than asking for one specific attribute (like color or size) at a time.

Keeping track of both categorized keywords and the user's raw text ensures we never lose important descriptions that our hand-built keyword lists might have missed.

What's next for Shop It All Here (SIAH)

Add a lightweight language model or synonym dictionary so the agent understands casual wording (like knowing "sneakers" means "athletic shoes") without relying only on exact keyword matches.

Write a script to automatically test and find the best BM25 column weights (title, categories, features, description) across the dataset to improve ranking accuracy.

Built With

Share this project:

Updates