AI-powered sales and customer service chatbot for MyLastShop, built with Pydantic AI and FastAPI.
- AI Sales Agent ("לסטי"): Hebrew-speaking chatbot powered by Google Gemini
- Knowledge Base: MongoDB Atlas vector search for product information
- Order Management: Google Sheets integration for order storage
- Human Escalation: Automatic detection and handoff to human support
- Session Memory: Conversation history persistence
- Modern Chat UI: RTL Hebrew support with responsive design
- Python 3.11+
- Google Gemini API key
- OpenAI API key (for embeddings)
- MongoDB Atlas cluster with vector search enabled
- Google Sheets service account credentials
- Clone and setup
cd LustBot-claude\ code
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r backend/requirements.txt- Configure environment
# Edit .env file with your credentials
cp .env.example .env-
Add Google Sheets credentials Place your
credentials.jsonfile in the project root. -
Run the backend
cd backend
uvicorn app.main:app --reload --port 8000- Open the frontend
Open
frontend/index.htmlin your browser, or serve it:
# Using Python's built-in server
cd frontend
python -m http.server 3000Then visit http://localhost:3000
docker-compose up -dAccess the chat at http://localhost
ecommerce-chatbot/
├── backend/
│ ├── app/
│ │ ├── agents/ # Pydantic AI agent
│ │ ├── tools/ # Vector store, Google Sheets, escalation
│ │ ├── models/ # Pydantic models
│ │ ├── services/ # Memory, MongoDB, embeddings
│ │ ├── routers/ # API endpoints
│ │ └── main.py # FastAPI entry point
│ ├── requirements.txt
│ └── Dockerfile
├── frontend/
│ ├── index.html
│ ├── css/styles.css
│ └── js/
│ ├── api.js
│ └── chat.js
├── docker-compose.yml
├── nginx.conf
└── .env
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/chat |
Send message and get response |
| GET | /api/history/{session_id} |
Get conversation history |
| DELETE | /api/history/{session_id} |
Clear session history |
| GET | /api/admin/health |
Health check |
| GET | /api/admin/sessions |
List active sessions |
| GET | /api/admin/escalations |
List escalation history |
| Variable | Description |
|---|---|
GOOGLE_API_KEY |
Google Gemini API key |
OPENAI_API_KEY |
OpenAI API key for embeddings |
MONGODB_URI |
MongoDB Atlas connection string |
MONGODB_DATABASE |
Database name |
MONGODB_COLLECTION |
Collection name for vector store |
MONGODB_VECTOR_INDEX |
Vector search index name |
GOOGLE_SHEETS_CREDENTIALS_PATH |
Path to service account JSON |
GOOGLE_SHEETS_SPREADSHEET_ID |
Google Sheets ID |
GOOGLE_SHEETS_SHEET_NAME |
Sheet name for orders |
Ensure your MongoDB collection has a vector search index:
{
"mappings": {
"dynamic": true,
"fields": {
"embedding": {
"dimensions": 1536,
"similarity": "cosine",
"type": "knnVector"
}
}
}
}The bot automatically detects these Hebrew keywords and offers human support:
- אדם, נציג, בן אדם, מנהל
- עזור לי, עזרה, תלונה
- החזר, זיכוי, דחוף
- And more...
Private - MyLastShop