Arafath10 commited on
Commit
ed8536b
·
verified ·
1 Parent(s): b0357a6

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +16 -19
main.py CHANGED
@@ -66,39 +66,36 @@ async def reply_whatsapp(request: Request):
66
  print("help desk option")
67
 
68
  openai.api_key = os.environ["OPENAI_API_KEY"]
69
-
70
- messages = [
71
- {"role": "system", "content": "you are parallax technologies chatbot design for answer the user question like a real human"},
72
- {"role": "user", "content": user_query+". always give small and realistic response"}
73
- ]
74
  prompt = f"""
75
  system:
76
- you are parallax technologies chatbot design for answer the user question like a real human for only greedings,contact us , who are you.
77
  contact details : Hotline : 0114 226 999 Email : [email protected] Youtube : https://www.youtube.com/channel/UCFkX9Fa-Qe6Qi4V5f0RcfSA Facebook : https://www.facebook.com/storemateinventory web link : https://storemate.lk
78
- don't give answer other questions just say "i don't know"
79
- only give single answer
80
  user:{user_query}
81
  """
 
 
 
 
 
82
  gen_response = model.generate_content(prompt)
83
 
84
- # gpt_response = openai.chat.completions.create(
85
 
86
- # model="gpt-3.5-turbo",
87
 
88
- # messages=messages,
89
 
90
- # temperature=0,
91
 
92
- # )
93
 
94
- # response.message(str(gpt_response.choices[0].message.content))
95
  #response.message(gen_response.text)
96
- response.message(gen_response.text +"\n\n"+default)
97
  return PlainTextResponse(str(response), media_type="application/xml")
98
-
99
- #result = ""
100
- #for lines in str(gpt_response).split("\n"):
101
- #result = result +"<p>"+lines+"</p><br>"
102
  response.message(str(gpt_response))
103
  #response.message("https://storemate.lk")
104
  return PlainTextResponse(str(response), media_type="application/xml")
 
66
  print("help desk option")
67
 
68
  openai.api_key = os.environ["OPENAI_API_KEY"]
 
 
 
 
 
69
  prompt = f"""
70
  system:
71
+ you are parallax technologies chatbot design for answer the user question like a real human.
72
  contact details : Hotline : 0114 226 999 Email : [email protected] Youtube : https://www.youtube.com/channel/UCFkX9Fa-Qe6Qi4V5f0RcfSA Facebook : https://www.facebook.com/storemateinventory web link : https://storemate.lk
73
+
74
+ only give single answer and don't give answer for general answers(this is CRM system for only pos system clients)
75
  user:{user_query}
76
  """
77
+ messages = [
78
+ {"role": "system", "content": "you are parallax technologies chatbot design for answer the user question like a real human"},
79
+ {"role": "user", "content": prompt}
80
+ ]
81
+
82
  gen_response = model.generate_content(prompt)
83
 
84
+ gpt_response = openai.chat.completions.create(
85
 
86
+ model="gpt-4o-mini",
87
 
88
+ messages=messages,
89
 
90
+ temperature=0,
91
 
92
+ )
93
 
94
+ response.message(str(gpt_response.choices[0].message.content)+"\n\n"+default)
95
  #response.message(gen_response.text)
96
+ #response.message(gen_response.text +"\n\n"+default)
97
  return PlainTextResponse(str(response), media_type="application/xml")
98
+
 
 
 
99
  response.message(str(gpt_response))
100
  #response.message("https://storemate.lk")
101
  return PlainTextResponse(str(response), media_type="application/xml")