Skip to content

This repository contains a stateful AI shopping assistant for JD.com, implementing multimodal product search (text + image OCR) with LangGraph state management. Features Playwright automation, Gemini/Qwen-VL integration, and Gradio UI.

License

Notifications You must be signed in to change notification settings

CAI991108/JD_search_agent

Repository files navigation

🛍️ JD Search Agent (Demo)

License: MIT Open in Kaggle Gradio Demo

Your smart shopping companion for JD.com, powered by multimodal generative AI! 🚀

🤗 For more details breakdown and implementation,please refer to our Kaggle Notebook

✨ Key Features

  • 🤖 Intelligent Product Search
    Natural language queries with dynamic requirement clarification
  • 👁️ Multimodal Understanding
    Combines text search + image OCR + structured data analysis
  • 💰 Smart Price Optimization
    Auto-detects government subsidies & promotions
  • 📊 Comparative Analysis
    Generates product comparison tables with reasoning
  • 🔄 Stateful Conversations
    Maintains context across multi-turn interactions

Demo Screenshot

🧠 Tech Stack

Core Components

LangGraph Playwright Gemini Qwen-VL

Architecture

[User Query]
│
▼    
[Intent Analysis]: 
│
├─[Yes]─▶ [JD Product Search] ─▶ [Multimodal Processing]
│                                    │
└─[No]──▶ [Knowledge Base Query] ────┘
▼
[Recommendation Generation]
│
▼
[Structured Output]

🚀 Getting Started

Prerequisites

pip install -qU \
  openai==1.70.0 \
  langchain-core==0.3.50 \
  langchain-google-genai==2.0.8 \
  langgraph==0.3.25 \
  langgraph-prebuilt==0.1.8 \
  playwright==1.51.0 \
  nest-asyncio==1.6.0 \
  typing-extensions==4.13.1

pip install playwright==1.51.0 -qU
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD=1 playwright install chromium
  • Python 3.9+
  • Playwright browsers: playwright install chromium
  • Get API Keys: Google Gemini and OpenRouter
    • remember to replace with your own GOOGLE_API_KEY and OPENAI_API_KEY in the .py files
  • Prepare yourt JD cookies (run locally: login_and_save_cookie.py)
    • Follow prompts to login to JD.com
    • Cookies will auto-save to jd_cookies.json

Launch Demo

python Gradio_UI.py

Access the Gradio UI at http://localhost:7861

🌟 Example Interaction

User:  Find thin gaming laptops under 15000 with RTX 4060
Bot: 🔍 Searching JD.com... Found 3 options!
     1. ROG Zephyrus G14 (¥14,999)
     2. Lenovo Legion 5 Pro (¥13,888)
     3. HP Victus 16 (¥12,999)
     [Comparison table generated]
Input Type Original Data AI-Enhanced Data Information Gain
Product Image
爆款抢购
官方正品
幻X 2025
AI MAX 395
8000S显卡
+83% Key Information
User Query "Thin and light laptop with dedicated graphics"
Requirement Analysis:
- Graphics Card Type: RTX 4060+
- Weight: <1.8kg
- Budget: 8000-12000
+62% Semantic Understanding

📸 Demo Screenshots

Demo 1 - Product Search
Demo 2 - Comparison Table
📷 Click to see image descriptions
  • top: Real-time product search interface
  • bottow: Interactive comparison table with purchase links

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

This repository contains a stateful AI shopping assistant for JD.com, implementing multimodal product search (text + image OCR) with LangGraph state management. Features Playwright automation, Gemini/Qwen-VL integration, and Gradio UI.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages