- Docker and Docker Compose
- PHP 8.1+ with Composer
- OpenAI API key
-
Create environment file:
cp .env.example .env # Or run: bash setup-env.sh -
Update your OpenAI API key in .env:
OPENAI_API_KEY=your-actual-openai-api-key -
Start services:
docker compose up -d
-
Install dependencies and setup Laravel:
composer install php artisan key:generate
-
Run migrations and seed data:
php artisan migrate php artisan db:seed --class=DemoProductSeeder
-
Index products in Qdrant:
php artisan rag:reindex
-
Start the application:
php artisan serve
Test with exact SKU match:
curl -X POST http://127.0.0.1:8000/api/chat \
-H 'Content-Type: application/json' \
-d '{"q":"KRC-200"}'Test with semantic search:
curl -X POST http://127.0.0.1:8000/api/chat \
-H 'Content-Type: application/json' \
-d '{"q":"Kashmiri Red Chilli 200g price"}'Success response:
{
"reply": "Here are the closest matches:",
"products": [
{
"id": 1,
"sku": "KRC-200",
"name": "Kashmiri Red Chilli 200g",
"brand": "Chukde",
"price": 220.00,
"offer_price": 199.00,
"currency": "INR",
"price_updated_at": "2025-01-21 12:01:33",
"url": "https://chukde.com/product/kashmiri-red-chilli-200g"
}
]
}Not found response:
{
"reply": "I couldn't find that product on chukde.com right now."
}- MySQL: Stores product data and live prices
- Qdrant: Vector database for semantic search
- OpenAI: Embeddings API for text vectorization
- Laravel: API framework with auto-indexing via model events
Products are automatically indexed when:
- Product is created/updated (UpsertProductVector job)
- Product is deleted (DeleteProductVector job)
In development, jobs run synchronously (QUEUE_CONNECTION=sync).
In production, use queue workers with QUEUE_CONNECTION=database or redis.
- Adjust
score_thresholdin ChatController (default: 0.75) - Higher threshold = more strict matching
- Lower threshold = more lenient matching