A production-grade agentic RAG pipeline for intelligent product search and cart/checkout Q&A, powered by LangChain orchestration, LlamaIndex retrieval, FAISS vector store, and asynchronous Kafka inference workers.
CSV/JSON Product Dump
│
▼
Ingestion Worker (Kafka Producer)
│
▼
LlamaIndex Indexer → FAISS Vector Store
│
▼
LangChain Agent (ReAct)
├── Semantic Search Tool
├── Cart Q&A Tool
└── Kafka Consumer (async inference)
│
▼
FastAPI REST + WebSocket API
│
▼
React Frontend
- 🔍 Semantic Product Search — natural language queries over FAISS-indexed product catalog
- 🛒 Cart & Checkout Q&A — context-aware answers about cart state, pricing, shipping
- ⚡ Async Inference Workers — Kafka-backed worker pool for scalable, non-blocking inference
- 🧠 Agentic ReAct Loop — LangChain agent decides which tool to invoke per query
- 📦 CSV/JSON Ingestion — plug in any product dump, auto-indexed on startup
- 🐳 Docker Compose — one command to spin up the full stack
| Layer | Technology |
|---|---|
| Orchestration | LangChain (ReAct Agent) |
| Retrieval | LlamaIndex + FAISS |
| Async Messaging | Apache Kafka |
| API | FastAPI + WebSocket |
| Embeddings | OpenAI text-embedding-3-small |
| LLM | OpenAI gpt-4o |
| Frontend | React + Vite |
| Containerization | Docker Compose |
git clone https://github.com/yourname/ecommerce-copilot
cd ecommerce-copilot
cp .env.example .env
# Fill in your OPENAI_API_KEY in .envDrop a products.csv or products.json into the data/ directory.
CSV format:
id,name,description,price,category,stock
1,Widget Pro,A premium widget,29.99,Tools,150
docker-compose up --build- Frontend: http://localhost:5173
- API docs: http://localhost:8000/docs
- Kafka UI: http://localhost:8080
# Backend
cd backend
pip install -r requirements.txt
uvicorn api.main:app --reload
# Worker (separate terminal)
python -m workers.inference_worker
# Frontend
cd frontend
npm install
npm run devecommerce-copilot/
├── backend/
│ ├── agents/ # LangChain ReAct agent + tools
│ ├── api/ # FastAPI app, routes, WebSocket
│ ├── core/ # Config, logging, dependencies
│ ├── kafka/ # Producer/consumer abstractions
│ ├── retrieval/ # LlamaIndex indexer + FAISS store
│ └── workers/ # Async inference worker
├── frontend/ # React + Vite app
├── data/ # Drop CSV/JSON product dumps here
├── docker/ # Dockerfiles
├── scripts/ # Seed data, index builder scripts
├── docker-compose.yml
└── .env.example
| Variable | Description |
|---|---|
OPENAI_API_KEY |
Your OpenAI API key |
KAFKA_BOOTSTRAP_SERVERS |
Kafka broker address (default: localhost:9092) |
FAISS_INDEX_PATH |
Path to persist FAISS index |
PRODUCTS_DATA_PATH |
Path to CSV/JSON product file |
LOG_LEVEL |
DEBUG / INFO / WARNING |
MIT