masadonline commited on
Commit
4b21c76
·
verified ·
1 Parent(s): 90d7a76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -59,11 +59,23 @@ def generate_answer_with_groq(question, context, retries=3, delay=2):
59
  "Authorization": f"Bearer {api_key}",
60
  "Content-Type": "application/json",
61
  }
62
- prompt = f"Based on the following context, answer the question: '{question}'\n\nContext:\n{context}"
 
 
 
 
63
  payload = {
64
  "model": "llama3-8b-8192",
65
  "messages": [
66
- {"role": "system", "content": "Hey there! I'm designed to respond just like a real person would. Ask me anything, and I'll do my best to give you a thoughtful and courteous answer."},
 
 
 
 
 
 
 
 
67
  {"role": "user", "content": prompt},
68
  ],
69
  "temperature": 0.5,
 
59
  "Authorization": f"Bearer {api_key}",
60
  "Content-Type": "application/json",
61
  }
62
+ prompt = (
63
+ f"Customer asked: '{question}'\n\n"
64
+ f"Here is the relevant product or policy info to help:\n{context}\n\n"
65
+ f"Respond in a friendly and helpful tone as a toy shop support agent."
66
+ )
67
  payload = {
68
  "model": "llama3-8b-8192",
69
  "messages": [
70
+ {
71
+ "role": "system",
72
+ "content": (
73
+ "You are ToyBot, a friendly and helpful WhatsApp assistant for an online toy shop. "
74
+ "Your goal is to politely answer customer questions, help them choose the right toys, "
75
+ "provide order or delivery information, explain return policies, and guide them through purchases. "
76
+ "Always sound warm, helpful, and trustworthy like a professional customer support agent."
77
+ )
78
+ },
79
  {"role": "user", "content": prompt},
80
  ],
81
  "temperature": 0.5,