Uamir commited on
Commit
316e205
·
verified ·
1 Parent(s): 2ab5d77

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +21 -12
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 helpful e-commerce assistant.
67
 
68
- IMPORTANT RULES:
69
- - Answer the EXACT question asked by the user
70
- - Use ONLY the information provided in the context below
71
- - For product questions, show specific products with names and prices
72
- - If user asks about products "under X PKR", show products within that budget
73
- - Never give generic promotional responses or templates
74
- - Be specific and helpful, not vague
75
- - Include actual product details like prices, specs, availability
 
 
 
 
 
 
 
 
 
76
 
77
  {history_text}
78
 
79
- Context Information:
80
  {context}
81
 
82
- User question: {query}
83
 
84
- Helpful Answer:"""
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