Led development of an assistant that uses an agent and RAG to support online customer consultations and recommend products.
Context
- Samsung Electronics wanted an assistant to give customers consistent answers in stores, in its online store, and through consultation agents.
Problem
Scroll sideways to see the whole diagram
Components
- Outside channels: Ads; Search & compare; Price check; How-to search
- Samsung channels: Store visit; Purchase; Delivery & setup; Register; Service inquiry; Buy again
Path: Ads → Search & compare → Store visit → Price check → Purchase → Delivery & setup → Register → How-to search → Service inquiry → Buy again
Pain points
- Too many lookalikes reviews hard to trust (Search & compare)
- Which promotions apply? I might miss out (Price check)
- Can't track or change delivery no one answers (Delivery & setup)
- Is it broken? The agent isn't sure either (Service inquiry)
- Customers researched reviews and prices on external sites and came to Samsung channels only to buy.
- Staff could not answer questions about product comparisons or promotions on the spot. Customers dropped out while waiting for phone transfers about deliveries or repairs, costing sales opportunities.
- Customers had to find a different contact at each stage of the customer journey, including product discovery and repeat purchases.
My role
- Led a project team of about 30 and directed the architecture design and core module development.
- Defined the platform architecture, 18 response scenarios, the data model, and admin requirements. Built the orchestrator pipeline, predefined answer and guardrail modules, and prompt templates.
Approach
- Built a channel-independent platform behind an API gateway, so new channels and features reuse the same modules.
- Evolved the architecture over three versions, from a single-pipeline MVP to separate structured and unstructured retrieval with reranking and guardrails, then to parallel execution.
- Split queries into sub-queries in the final version, ran structured, unstructured, and web searches in parallel, and routed simple and informative questions separately.
- Established an evaluation framework for the RAG service and automated evaluation with Ragas.
Scroll sideways to see the whole diagram
Components
- Version 1 (MVP): Query rewrite; Intent triage; Entities, code mapping; Pseudo query; Data lookup, one combined path; Answer, templates
- Version 2: Query rewrite; Intent triage; Predefined answers, guardrails, FAQ, attack check, re-asking (Added in this version); Entities, code mapping; Pseudo query; DB lookup, structured; Unstructured, AI search (Added in this version); Reranking (Added in this version); Answer
- Version 3: Rewrite, split, sub-queries (Added in this version); Predefined; Guardrails; Entities, triage, mapping; Pseudo query, DB / API; AI search + web search, unstructured (Added in this version); Merge data (Added in this version); Answer, simple / informative (Added in this version)
Connections
- Query rewrite (Version 1 (MVP)) to Intent triage (Version 1 (MVP))
- Intent triage (Version 1 (MVP)) to Entities (Version 1 (MVP))
- Entities (Version 1 (MVP)) to Pseudo query (Version 1 (MVP))
- Pseudo query (Version 1 (MVP)) to Data lookup
- Data lookup to Answer (Version 1 (MVP))
- Query rewrite (Version 2) to Intent triage (Version 2)
- Intent triage (Version 2) to Predefined answers, guardrails
- Intent triage (Version 2) to Entities (Version 2)
- Entities (Version 2) to Pseudo query (Version 2)
- Pseudo query (Version 2) to DB lookup
- DB lookup to Answer (Version 2)
- Intent triage (Version 2) to Unstructured
- Unstructured to Reranking
- Predefined answers, guardrails to Answer (Version 2)
- Reranking to Answer (Version 2)
- Rewrite, split to Predefined
- Rewrite, split to Entities (Version 3)
- Rewrite, split to AI search + web search
- Predefined to Guardrails
- Entities (Version 3) to Pseudo query (Version 3)
- Guardrails to Merge data
- Pseudo query (Version 3) to Merge data
- AI search + web search to Merge data
- Merge data to Answer (Version 3)
Key decisions
| Decision | Why | Trade-off |
|---|---|---|
| A modular platform shared across channels | The team can reuse the modules as it adds channels or features and hand the service over to operations through an admin page. | Slower initial MVP delivery. |
| Entity mapping and pseudo queries | Mapping extracted entities to codes and a predefined view schema lets the team validate queries and keep them secure without direct Text-to-SQL. | Mapping tables must be maintained for each new query type. |
| Predefined answers that bypass the LLM | Greetings, FAQs, and policy-restricted answers come from a table, cutting cost and latency. | Less flexible answers and a table to maintain. |
Architecture
Scroll sideways to see the whole diagram
Components
- Channels: Offline stores; Online store; Agent console
- Gen AI platform on Azure: API gateway (channel-independent); Admin page, logs, monitoring, permissions, personal data
- Understand: Query rewrite (LLM call); Intent triage; Entity extraction (LLM call)
- Retrieve: Structured (pseudo query); Unstructured search; Check specs, prices, promos
- Answer: Predefined answers (Answered without the LLM); Guardrails; Response layout (LLM call)
- Models and storage: LLM, Azure OpenAI (LLM call); Web search, Bing; Structured, PostgreSQL; Unstructured, Azure AI Search; Cache, Redis; User logs, Cosmos DB
- Data sources: Orders, payment, delivery; Product catalog; Manuals; Stores, online mall; Service and CS; Existing Gen AI
Connections
- Channels with Gen AI platform on Azure
- API gateway (channel-independent) to Understand
- Understand to Retrieve
- Retrieve to Answer
- Gen AI platform on Azure with Models and storage
- Models and storage with Data sources
Service flow
Scroll sideways to see the whole diagram
Components
- Question; Merge data; Response layout, simple, informative, re-ask (LLM call); Answer; Update history
- Orchestrator: Chat history; Language ID (LLM call); Rewrite, split, top + sub-queries (LLM call); Embedding
- Structured (sub-queries): Intent triage; Entity extraction (LLM call); Code mapping; Pseudo query (LLM call); DB / API query
- Unstructured (top query): Intent triage; Entity extraction (LLM call); AI search, + verify item; Web search, Bing
- Predefined, guardrails: Predefined, greetings, FAQ (Answered without the LLM); Guardrails, attacks, policy limits
Connections
- Question to Chat history
- Chat history to Language ID
- Language ID to Rewrite, split
- Rewrite, split to Embedding
- Embedding to Intent triage (Structured (sub-queries))
- Embedding to Intent triage (Unstructured (top query))
- Embedding to Predefined
- Intent triage (Structured (sub-queries)) to Entity extraction (Structured (sub-queries))
- Entity extraction (Structured (sub-queries)) to Code mapping
- Code mapping to Pseudo query
- Pseudo query to DB / API query
- Intent triage (Unstructured (top query)) to Entity extraction (Unstructured (top query))
- Entity extraction (Unstructured (top query)) to AI search
- Entity extraction (Unstructured (top query)) to Web search
- Predefined to Guardrails
- DB / API query to Merge data
- AI search to Merge data
- Web search to Merge data
- Guardrails to Merge data
- Merge data to Response layout
- Response layout to Answer
- Response layout to Update history
Outcome
- Automated answers for 18 customer scenarios previously handled one by one by agents, and handed the service over to operations for online and offline stores.
- Halved average response time from 10 s to 5 s between versions 2 and 3.
- Cut LLM call cost by 50% by serving frequent questions with predefined answers.