bad17b15
tangwang
θ°ιbaseline
|
1
|
# ShopAgent
|
e7f2b240
tangwang
first commit
|
2
3
4
5
6
7
8
9
10
|
An autonomous multi-modal fashion shopping agent powered by **LangGraph** and **ReAct pattern**.
## Demo
π **[demo.pdf](./demo.pdf)**
## Overview
|
bad17b15
tangwang
θ°ιbaseline
|
11
|
ShopAgent autonomously decides which tools to call, maintains conversation state, and determines when to respond. Built with **LangGraph**, it uses agentic patterns for intelligent product discovery.
|
e7f2b240
tangwang
first commit
|
12
13
14
|
**Key Features:**
- Autonomous tool selection and execution
|
8810a6fa
tangwang
ιζ
|
15
|
- Text search via Search API
|
e7f2b240
tangwang
first commit
|
16
|
- Conversational context awareness
|
8810a6fa
tangwang
ιζ
|
17
|
- Real-time visual analysis (style extraction from images)
|
e7f2b240
tangwang
first commit
|
18
19
20
21
22
23
24
|
## Tech Stack
| Component | Technology |
|-----------|-----------|
| **Agent Framework** | LangGraph |
| **LLM** | any LLM supported by LangChain |
|
8810a6fa
tangwang
ιζ
|
25
|
| **Search** | Search API (HTTP) |
|
e7f2b240
tangwang
first commit
|
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
| **Frontend** | Streamlit |
| **Dataset** | Kaggle Fashion Products |
## Architecture
**Agent Flow:**
```mermaid
graph LR
START --> Agent
Agent -->|Has tool_calls| Tools
Agent -->|No tool_calls| END
Tools --> Agent
subgraph "Agent Node"
A[Receive Messages] --> B[LLM Reasoning]
B --> C{Need Tools?}
C -->|Yes| D[Generate tool_calls]
C -->|No| E[Generate Response]
end
subgraph "Tool Node"
F[Execute Tools] --> G[Return ToolMessage]
end
```
**Available Tools:**
|
8810a6fa
tangwang
ιζ
|
53
|
- `search_products(query)` - Text-based product search via Search API
|
e7f2b240
tangwang
first commit
|
54
55
56
57
58
59
60
61
62
63
64
65
|
- `analyze_image_style(image_path)` - VLM style analysis
## Examples
**Text Search:**
```
User: "winter coats for women"
Agent: search_products("winter coats women") β Returns 5 products
```
|
e7f2b240
tangwang
first commit
|
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
**Style Analysis + Search:**
```
User: [uploads vintage jacket] "what style is this? find matching pants"
Agent: analyze_image_style(path) β "Vintage denim bomber..."
search_products("vintage pants casual") β Returns matching items
```
**Multi-turn Context:**
```
Turn 1: "show me red dresses"
Agent: search_products("red dresses") β Results
Turn 2: "make them formal"
Agent: [remembers context] β search_products("red formal dresses") β Results
```
**Complex Reasoning:**
```
User: [uploads office outfit] "I like the shirt but need something more casual"
Agent: analyze_image_style(path) β Extracts shirt details
search_products("casual shirt [color] [style]") β Returns casual alternatives
|
8810a6fa
tangwang
ιζ
|
87
88
|
**Note:** For image uploads "find similar", use analyze_image_style first to extract attributes, then search_products with the description.
|
e7f2b240
tangwang
first commit
|
89
90
91
92
93
94
95
|
```
## Installation
**Prerequisites:**
- Python 3.12+ (LangChain 1.x θ¦ζ± Python 3.10+)
- OpenAI API Key
|
e7f2b240
tangwang
first commit
|
96
97
98
99
100
|
### 1. Setup Environment
```bash
# Clone and install dependencies
git clone <repository-url>
|
bad17b15
tangwang
θ°ιbaseline
|
101
|
cd ShopAgent
|
e7f2b240
tangwang
first commit
|
102
103
104
105
106
107
108
109
110
|
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
# Configure environment variables
cp .env.example .env
# Edit .env and add your OPENAI_API_KEY
```
|
8810a6fa
tangwang
ιζ
|
111
112
|
### 2. (Optional) Download Dataset
For image style analysis, you may download the [Fashion Product Images Dataset](https://www.kaggle.com/datasets/paramaggarwal/fashion-product-images-dataset) from Kaggle:
|
e7f2b240
tangwang
first commit
|
113
114
|
```bash
|
8810a6fa
tangwang
ιζ
|
115
|
python scripts/download_dataset.py
|
e7f2b240
tangwang
first commit
|
116
117
|
```
|
8810a6fa
tangwang
ιζ
|
118
|
### 3. Launch Application
|
e7f2b240
tangwang
first commit
|
119
120
121
122
123
124
125
|
```bash
# δ½Ώη¨ε―ε¨θζ¬οΌζ¨θοΌ
./scripts/start.sh
# ζη΄ζ₯θΏθ‘
streamlit run app.py
```
|
8810a6fa
tangwang
ιζ
|
126
127
128
|
Product search uses the external Search API. Configure `SEARCH_API_BASE_URL` and `SEARCH_API_TENANT_ID` in `.env` if needed.
|
e7f2b240
tangwang
first commit
|
129
130
131
132
|
Opens at `http://localhost:8501`
### CentOS 8 ι¨η½²
θ―¦θ§ [docs/DEPLOY_CENTOS8.md](docs/DEPLOY_CENTOS8.md)
|