Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -63,25 +63,34 @@ def ask_bot(query: str):
|
|
| 63 |
for turn in conversation_history[-6:]: # last 3 user-bot pairs
|
| 64 |
history_text += f"User: {turn['user']}\nBot: {turn['bot']}\n"
|
| 65 |
|
| 66 |
-
full_prompt = f"""You are ShopMart's
|
| 67 |
|
| 68 |
-
|
| 69 |
-
-
|
| 70 |
-
-
|
| 71 |
-
-
|
| 72 |
-
-
|
| 73 |
-
-
|
| 74 |
-
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
{history_text}
|
| 78 |
|
| 79 |
-
|
| 80 |
{context}
|
| 81 |
|
| 82 |
-
|
| 83 |
|
| 84 |
-
|
| 85 |
|
| 86 |
response = llm.invoke(full_prompt)
|
| 87 |
|
|
|
|
| 63 |
for turn in conversation_history[-6:]: # last 3 user-bot pairs
|
| 64 |
history_text += f"User: {turn['user']}\nBot: {turn['bot']}\n"
|
| 65 |
|
| 66 |
+
full_prompt = f"""You are ShopMart's e-commerce assistant. Follow these instructions STRICTLY:
|
| 67 |
|
| 68 |
+
🚫 NEVER respond with:
|
| 69 |
+
- "Amazing offers available now!"
|
| 70 |
+
- "Weekly Deals" or promotional templates
|
| 71 |
+
- Generic discount information
|
| 72 |
+
- "Check our deals page" responses
|
| 73 |
+
- Any pre-written marketing content
|
| 74 |
+
|
| 75 |
+
✅ ALWAYS respond with:
|
| 76 |
+
- Direct answer to the specific question asked
|
| 77 |
+
- Actual product information from the context data
|
| 78 |
+
- Real prices and availability status
|
| 79 |
+
- If product not found, say "I don't have information about that product"
|
| 80 |
+
|
| 81 |
+
EXAMPLE - If asked about MacBook Air M2 price:
|
| 82 |
+
"The MacBook Air M2 is priced at [ACTUAL PRICE] PKR and [STOCK STATUS]. [Add specs if available]"
|
| 83 |
+
|
| 84 |
+
NOT: "Amazing offers available now! Weekly deals..."
|
| 85 |
|
| 86 |
{history_text}
|
| 87 |
|
| 88 |
+
Available Product Data:
|
| 89 |
{context}
|
| 90 |
|
| 91 |
+
Customer Question: {query}
|
| 92 |
|
| 93 |
+
Direct Answer (no promotional templates):"""
|
| 94 |
|
| 95 |
response = llm.invoke(full_prompt)
|
| 96 |
|