An interactive retail assistant compatible with AlloyDB for PostgreSQL, featuring contextual search, brand filtering, and RRF (Reciprocal Rank Fusion) hybrid search.
Original demo and concept by Paul Ramsey. Modified and enhanced by Jason Massie.
- Google Cloud Project with AlloyDB and Vertex AI enabled.
- Python 3.10+
gcloudCLI installed and authenticated.
-
Clone the repository:
git clone git@github.com:jasonmassie01/RetailChatAgent.git cd RetailChatAgent -
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Copy
start.sh.exampletostart.shand set yourDB_PASSWORD.cp start.sh.example start.sh chmod +x start.sh # Edit start.sh with your password
-
Restore Backup: This repository includes a split zip archive
backup.zipcontainingproducts_backup.csvandinventory_items_backup.csv.- Run
zip -F backup.zip --out single_backup.zipand thenunzip single_backup.zip(or use a tool like 7-Zip) to extract the CSVs. - You can load these into your AlloyDB instance using
pandasorCOPYcommand if you need to recreate the data.
- Run
-
Schema: ensure your AlloyDB database has the
vectorextension enabled and tables created matching the CSV structure.
The application uses product images.
- If images are stored in Google Cloud Storage (GCS), ensure your environment has access.
- The app handles
gs://URIs by converting them to signed URLs or public HTTP URLs if configured. - Default public bucket mirror:
https://storage.googleapis.com/pr-public-demo-data/alloydb-retail-demo/product-images-branded/
./start.shAccess the app at http://localhost:8501.
- Contextual Search: Remembers previous queries (e.g., "in red") to refine search results.
- Brand Filtering: Automatically extracts brand names using Gemini 2.0 Flash.
- Hybrid Search: Combines vector similarity and full-text search using RRF.
- Reranking: Uses
ai.rank(Vertex AI Semantic Ranker) to reorder results.