跪拜 Guibai
← Back to the summary

Meet the AI Shopping Agent That Can Recommend, Compare, and Place Orders

Preface

One-sentence positioning: A conversational e-commerce shopping guide AI Agent that can chat, recommend, and actually place orders.

Dimension Description
Tech Stack Spring AI (Alibaba), RAG (Milvus / PgVector), Function Calling, MCP, Graph workflow, SSE streaming output
Core Highlights Two-layer embedding semantic routing, RAG private knowledge Q&A, tool calls for order/return/review, order and cart UI snapshots
Suitable for People who want to combine AI with e-commerce business deeply and showcase workflow orchestration skills
Deliverables Complete source code + from-zero tutorial + 1-on-1 technical Q&A + resume coaching

Why it's worth putting on your resume

More project practice at Java Assault Team website: susan.net.cn/project

1. Project Overview

Smart Product Recommendation Assistant is a next-generation e-commerce shopping guide platform built on cutting-edge generative AI technology.

The system uses conversational UI to deeply understand vague, complex shopping intents, combines a private product knowledge base (RAG) and real-time business data (MCP/Function Calling) to provide precise product recommendations, price comparison analysis, and supports a complete transaction loop: ordering, returning, reviewing, and cancelling orders.

The system uses a combined architecture of RAG (Retrieval-Augmented Generation) + Function Calling (tool calling) + MCP + Graph workflow:

1.1 Core Value


2. Technology Stack Selection

Module Technology Choice Description
Backend Framework Spring Boot 3.5+ Core Java ecosystem, stable high-concurrency support
AI Integration Spring AI Alibaba Unified AI access layer, shields underlying model differences, supports OpenAI/Claude/Ollama, etc.
LLM Model Qwen / DeepSeek-V3 SOTA models with strong reasoning capabilities
RAG Engine Milvus / PgVector High-performance vector databases, store product document embeddings
Data Protocol MCP (Model Context Protocol) Unified data source interaction protocol, connects product center, order center
Agent Capabilities Function Calling / Skills Gives LLM ability to execute external tools (check inventory, place order)
Frontend Vue 3 + TailwindCSS Modern responsive UI (prototype exists)
API Protocol SSE (Server-Sent Events) Streaming typewriter effect responses
Workflow Graph workflow Graph progression within process

3. System Architecture Design

3.1 Overall Architecture Diagram (Mermaid)

architecture

3.2 Core Module Details

3.2.1 Intelligent Shopping Guide Agent Service (Spring AI Alibaba)

This is the brain of the system, responsible for orchestrating the entire conversation flow.

3.2.2 RAG Engine (Retrieval-Augmented Generation)

Used to solve LLM hallucination and knowledge lag problems.

3.2.3 MCP & Function Calling

Gives AI "hands" and "eyes".


4. Key Process Design

4.1 User Shopping Consultation Process (RAG + Function Calling)

  1. User asks: "Recommend a keyboard suitable for a programmer, budget around 1000 yuan."
  2. Intent recognition: Agent analyzes intent as RECOMMENDATION, extracts entities Category: Keyboard, Target: Programmer, Budget: ~1000.
  3. RAG retrieval:
    • System searches vector store for "programmer keyboard", "mechanical keyboard 1000 yuan" related product descriptions and reviews.
    • Recalls top 5 products: Keychron K2, NuPhy Air75, Logitech MX Mechanical, etc.
  4. Tool call (Function Calling):
    • LLM decides to call checkStock(productIds) to confirm whether recalled products are in stock.
    • LLM decides to call getLatestPromotion(productIds) to get current promo prices.
    • LLM decides to call getProductStock(skuId) to confirm inventory.
  5. Generate answer:
    • LLM combines static info from RAG (selling points, switch feel) and dynamic info from functions (inventory, real-time price).
    • Generates streaming reply: "For you I recommend Keychron K2 Pro... Currently in stock at JD flagship store, promo price 988 yuan..."

4.2 AI Implementation of Core Transaction Loop (Order/Return/Review/Cancel)

This system wraps transaction operations as tools callable by AI, enabling a full conversational shopping experience.

4.2.1 Smart Checkout

  1. User intent: "Buy that Keychron keyboard for me, with red switches."
  2. Slot filling:
    • AI identifies intent PLACE_ORDER.
    • Checks required parameters: Product=Keychron K2, Spec=Red Switch, Address=?, Payment=?.
    • If address is missing, AI asks back: "Please confirm shipping address, send to default home or company?"
  3. Tool call:
    • Once parameters are complete, calls createOrder(skuId, addressId, paymentMethod).
  4. Frontend interaction:
    • AI returns Function Result not as plain text but as UI Component JSON.
    • Frontend renders "order confirmation card" showing product, amount, address.
    • User clicks "Confirm Payment" button on the card (secondary confirmation for safety).

4.2.2 Smart Cancellation

  1. User intent: "I don't want that keyboard anymore, cancel it."
  2. Context retrieval:
    • AI calls queryRecentOrders(userId, limit=1) to get latest order.
    • Finds order status PENDING_SHIPMENT (not shipped), eligible for cancellation.
  3. Tool call:
    • Calls cancelOrder(orderId, reason="user voluntarily cancels").
  4. Feedback: "Order 20231025 has been successfully cancelled; refund will be returned to original payment method."

4.2.3 Smart Return

  1. User intent: "The earphones I received yesterday have static noise, I want to return them."
  2. RAG assistance:
    • AI retrieves "Electronics Return and Exchange Policy" from knowledge base.
    • Confirms "quality issues support 7-day no-reason return".
  3. Tool call:
    • Calls checkOrderEligibleForReturn(orderId) to verify eligibility.
    • Calls submitReturnRequest(orderId, type="QUALITY_ISSUE", desc="static noise").
  4. Process guidance: "Return request submitted. Please send the item back to the following address... shipping costs borne by us."

4.2.4 Smart Review

  1. User intent: "Write a good review for the yoga pants I just got, they feel comfortable."
  2. Content generation:
    • AI based on user keywords "comfortable to wear" and product features (RAG retrieval: skin-friendly, high elastic), automatically generates a quality review draft of about 50 words.
  3. Tool call:
    • AI shows draft: "Very comfortable to wear, fabric is skin-friendly and breathable, no restriction during yoga moves, recommended! (Publish?)"
    • After user confirms, calls submitProductReview(orderId, rating=5, content=...).

4.2 Data Ingestion Process

  1. Source data monitoring: Monitors product database changes (Binlog) or scheduled task scanning.
  2. ETL processing: Cleans HTML tags, extracts key specification parameters.
  3. Document chunking: Splits product details into multiple chunks like "basic info", "specifications", "user reviews".
  4. Vectorization: Calls Embedding API to generate vectors.
  5. Upsert: Writes to vector database with Metadata (Category, PriceRange) to support hybrid retrieval.

4.3 AI-Driven Full Transaction Flow Design

This system not only supports information queries, but also implements end-to-end automation of ordering, returning, reviewing, and cancelling via Transactional Agents. Each flow has built-in Human-in-the-Loop (HITL) mechanisms for safety.

4.3.1 Order Placement

User command: "Buy the Keychron keyboard you recommended earlier, ship to company."

  1. Context parsing: Agent retrieves recently recommended product entity (Keychron K2 Pro, SKU: RGB-Red-Switch) from ChatMemory.
  2. Address matching: Calls AddressBookService to get user-labeled "company" shipping address.
  3. Order preview (Dry Run):
    • Calls previewOrder(sku, quantity, addressId) to calculate final price (including shipping, coupons).
    • HITL confirmation: AI outputs order card (with price details) and pauses execution, waiting for explicit user instruction ("confirm order" / "Yes").
  4. Execute transaction: After user confirms, AI calls createOrder API and returns order number and payment link.

4.3.2 Order Cancellation

User command: "Don't want that order anymore, cancel it."

  1. Intent recognition: Identifies intent as CANCEL_ORDER.
  2. Query status: Calls listRecentOrders(limit=1) to get latest order, checks if status is PENDING_PAYMENT or PAID (not shipped).
  3. Risk control:
    • If order already shipped, AI automatically switches to "return/intercept" flow and informs user.
    • If not shipped, AI asks for cancellation reason (optional) and requests second confirmation.
  4. Execute cancellation: After user confirms, calls cancelOrder(orderId) and triggers refund process.

4.3.3 Return & Refund

User command: "These earphones are uncomfortable to wear, I want to return them."

  1. Eligibility check (RAG):
    • AI extracts SKU, retrieves the product's "after-sales policy" doc from vector store.
    • Determines if "7-day no-reason" or "no return after unsealing" conditions apply.
  2. Generate application:
    • If eligible, AI calls createReturnRequest(orderId, reason="discomfort when wearing").
    • If not eligible (e.g., out of warranty), AI politely declines citing policy doc and suggests human customer service.
  3. Logistics appointment: Calls schedulePickup(address, time) to arrange courier pickup.

4.3.4 AI-Assisted Review

User command: "Keyboard arrived, great feel, help me write a good review."

  1. Sentiment analysis: Identifies user sentiment as POSITIVE, keywords "great feel".
  2. Content generation: AI based on keywords generates a quality review: "Keychron K2 Pro truly lives up to its name, red switches feel light, typing sound is crisp, perfect for long coding sessions, five-star recommendation!"
  3. User confirmation: Shows generated content, user can choose "publish directly" or "edit".
  4. Submit review: Calls submitReview(orderId, content, rating=5).

FAQ

What is the Smart Product Recommendation Assistant?

It's a conversational e-commerce shopping guide AI Agent: users describe needs in natural language (e.g., "birthday gift for a programmer boyfriend"), the system understands intent, recommends products, compares prices, and supports a transaction loop of ordering, returning, reviewing, and cancelling.

What problem does RAG solve in shopping scenarios?

Product specs and after-sales policies are private knowledge LLMs don't know. RAG injects product docs and knowledge base chunks into the prompt via vector retrieval, making answers grounded and explainable.

How do Function Calling and MCP work together?

Function Calling is responsible for invoking business actions (check inventory, place order, return), MCP standardizes connections to multiple data sources (product center, order center). The former solves "can do things", the latter solves "can connect in".

Why is a light-weight embedding semantic router needed?

A user's utterance may contain multiple intents. The system first uses embedding for two-layer routing (coarse classify: process/tool/recommendation/small talk, then sub-classify process), then enters corresponding Graph nodes, making processes more controllable and resistant to natural language variation.

Can conversational shopping complete ordering, return, and review?

Yes. The project completes the full transaction loop: smart ordering, smart cancellation, smart return, smart review all have implementations, and uses SSE streaming output and UI snapshots like order cards to enhance interaction.

Is this AI shopping project suitable for a resume?

Yes. It simultaneously demonstrates AI capabilities (RAG, Function Calling, MCP, Graph orchestration) and business system design skills, and is a natural combination of "AI + business".

More project practice at Java Assault Team website: susan.net.cn/project

Project Screenshots

screenshot1

screenshot2

screenshot3