An AI-powered customer support chatbot for an e-commerce store, built with a hybrid RAG + tool-calling architecture.
Live Demo → https://shopquick-chatbot.streamlit.app/
User Query
│
▼
┌─────────────────────┐
│ Query Classifier │ is_policy_question()
└─────────────────────┘
│ │
▼ ▼
Policy Q? Order/Inventory Q?
│ │
▼ ▼
┌────────┐ ┌──────────┐
│ RAG │ │ Tools │
│ │ │ │
│Chunks │ │order_tool│
│from │ │inventory │
│ChromaDB│ │_tool │
└────────┘ └──────────┘
│ │
└───────┬───────┘
▼
┌───────────────┐
│ Groq LLaMA │
│ 3.3 70B │
└───────────────┘
│
▼
Response
Why hybrid?
- RAG handles unstructured policy documents (return policy, shipping, refunds) — data that changes rarely and lives in text files
- Tools handle structured live data (order status, inventory) — data that changes constantly and lives in a database
- A classifier routes queries to the right path, avoiding unnecessary embedding calls on structured queries
- Answer return, refund, exchange & shipping policy questions via RAG
- Look up order status by order ID via tool calling
- Check product availability by size via tool calling
- Conversation memory within a session
- Clickable suggested questions
- Clean chat UI with Streamlit
| Component | Technology |
|---|---|
| LLM | Groq (LLaMA 3.3 70B) — free |
| Embeddings | sentence-transformers (local) — free |
| Vector DB | ChromaDB (local) — free |
| UI | Streamlit |
| Language | Python 3.10+ |
1. Clone the repo
git clone https://github.com/your-username/ecom-support-agent.git
cd ecom-support-agent2. Install dependencies
pip install -r requirements.txt3. Add your Groq API key
cp .env.example .env
# Edit .env and add your key from https://console.groq.com4. Run the app
streamlit run app.pyThe policy document is ingested automatically on first run.
ecom-support-agent/
├── app.py # Streamlit UI + agent logic
├── main.py # Terminal version (alternative)
├── requirements.txt
├── .env.example
├── data/
│ ├── policy.txt # Store policy document (RAG source)
│ └── mock_db.py # Mock orders and inventory
├── tools/
│ ├── order_tool.py # get_order_status() + OpenAI-compatible schema
│ └── inventory_tool.py # check_inventory() + schema
├── rag/
│ ├── ingest.py # Chunk → embed → store in ChromaDB
│ └── retriever.py # Embed query → retrieve top-k chunks
└── .streamlit/
└── secrets.toml # API keys for deployment (not committed)
| Query | Path taken |
|---|---|
| "What is your return policy?" | RAG → policy chunks → LLM |
| "Status of order ORD-1002?" | Tool → mock DB → LLM |
| "Is Classic White Tee in size M available?" | Tool → mock DB → LLM |
| "Can I exchange a damaged item?" | RAG → policy chunks → LLM |