How nvidia-ai-blueprints/retail-shopping-assistant works
Project Type and Purpose
• This is a full-stack, microservices AI application: the “Retail Shopping Assistant” blueprint.
• Purpose: provide a conversational, multimodal (text+image) shopping assistant using a multi-agent orchestration (LangGraph), servicing UI requests, product retrieval, memory/cart management, and content safety.
File Structure Highlights
• Top-level microservices directories:
• chain_server/ – FastAPI + LangGraph orchestrator (“brain”).
• catalog_retriever/ – Product search & recommendations agent.
• memory_retriever/ – User context & cart state agent.
• guardrails/ – Moderation & safety agent.
• ui/ – React + TypeScript frontend.
• Shared resources: shared/configs/, shared/data/ (product CSVs), shared/images.
• Deployment: Dockerfiles in each service, docker-compose.yaml (and docker-compose-nim-local.yaml) for local vs. cloud deployments.
• Infrastructure as code: nginx.conf (ingress), GitHub workflows, config overrides.
Key Components
A. Frontend Layer
• React UI (ui/) served via NGINX reverse proxy (nginx.conf).
B. API Gateway / Ingress
• NGINX routes HTTP traffic to the Chain Server.
C. Orchestration Layer
• Chain Server (FastAPI + LangGraph) implements REST/WebSocket endpoints, agent orchestration, streaming.
D. Agent Microservices
1. Catalog Retriever – searches product catalog (calls vector DB or remote API).
2. Memory Retriever – manages user session context & cart state (in-memory or persistent store).
3. Guardrails – runs content moderation pipelines (NemoGuard models via NIM).
E. Data Stores & External Services
• Vector database (Milvus) for similarity search.
• NVIDIA NGC containers / NIM endpoints for LLM inference (e.g., Llama, NV-EmbedQA, CLIP).
• Product catalog CSVs (shared/data) and other static assets.
F. Configuration & Secrets
• shared/configs for service-specific YAMLs.
• ENV variables (API keys) injected at runtime.
Interactions & Data Flow
1. User submits query or image → UI (React)
2. UI → HTTP/WebSocket → NGINX → Chain Server
3. Chain Server uses LangGraph to fan-out tasks:
• Calls Catalog Retriever via REST for product search
• Calls Memory Retriever for past conversation/cart context
• Calls Guardrails for moderation of prompts/responses
• Calls GPU model endpoints (NGC/NIM) for LLM responses
4. Retriever services may query Milvus or CSV data.
5. Chain Server aggregates results, streams back to UI.
6. UI renders streaming chat + images + cart updates.
Architectural Patterns & Principles
• Microservices: each concern (retrieval, memory, safety) in its own container.
• Orchestrator Pattern: Chain Server choreographs agents via LangGraph.
• API Gateway: NGINX as ingress.
• Separation of concerns: UI vs. backend vs. data.
• Config-as-code: shared/configs with build vs. override YAMLs.
• Docker Compose for environment reproducibility.
Must-Include Elements
• Component labels: e.g., “UI (React)”, “Chain Server (FastAPI + LangGraph)”, “Catalog Retriever”, etc.