Arafath10 commited on
Commit
8486a5e
·
verified ·
1 Parent(s): 847bc9e

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +11 -10
main.py CHANGED
@@ -142,10 +142,11 @@ async def reply_whatsapp(request: Request):
142
 
143
 
144
  #msg.media(GOOD_BOY_URL)
145
- gpt_response = query_engine.query("""
146
- if you find the answer from provided data then give answer with steps and make the more details link within the <a href>lank hyper link.
147
- if not find the answer from provided data then say 'please contact our helpdesk' \n\n
148
- user question : """+user_query)
 
149
 
150
  print(str(gpt_response).lower())
151
  if "please contact our helpdesk" in str(gpt_response).lower() or "please contact" in str(gpt_response).lower():
@@ -153,8 +154,8 @@ async def reply_whatsapp(request: Request):
153
 
154
  openai.api_key = os.environ["OPENAI_API_KEY"]
155
 
156
- default = """<br><br>Dear<br>If you have a specific question or need assistance, please feel free to submit a ticket, and our support team will be happy to help you:<br><br>Submit a Ticket:<br>Email: [email protected]<br>Hotline: 0114 226 999<br><br>Thank You """
157
- messages = [{"role": "user", "content": user_query+". always give small answers"}]
158
  gpt_response = openai.chat.completions.create(
159
 
160
  model="gpt-3.5-turbo",
@@ -168,10 +169,10 @@ async def reply_whatsapp(request: Request):
168
  msg = response.message(str(gpt_response.choices[0].message.content) + default)
169
  return PlainTextResponse(str(response), media_type="application/xml")
170
 
171
- result = ""
172
- for lines in str(gpt_response).split("\n"):
173
- result = result +"<p>"+lines+"</p><br>"
174
- msg = response.message(result)
175
  return PlainTextResponse(str(response), media_type="application/xml")
176
 
177
 
 
142
 
143
 
144
  #msg.media(GOOD_BOY_URL)
145
+ gpt_response = query_engine.query(f"""
146
+ if you find the answer from provided data then give answer with steps and add the more details link.
147
+ if not find the answer from provided data then say 'please contact our helpdesk'
148
+
149
+ user question : {user_query}""")
150
 
151
  print(str(gpt_response).lower())
152
  if "please contact our helpdesk" in str(gpt_response).lower() or "please contact" in str(gpt_response).lower():
 
154
 
155
  openai.api_key = os.environ["OPENAI_API_KEY"]
156
 
157
+ default = """\n\nDear\nIf you have a specific question or need assistance, please feel free to submit a ticket, and our support team will be happy to help you:<br><br>Submit a Ticket:\nEmail: [email protected]\nHotline: 0114 226 999\nThank You """
158
+ messages = [{"role": "user", "content": user_query+". always give small and realistic response"}]
159
  gpt_response = openai.chat.completions.create(
160
 
161
  model="gpt-3.5-turbo",
 
169
  msg = response.message(str(gpt_response.choices[0].message.content) + default)
170
  return PlainTextResponse(str(response), media_type="application/xml")
171
 
172
+ #result = ""
173
+ #for lines in str(gpt_response).split("\n"):
174
+ #result = result +"<p>"+lines+"</p><br>"
175
+ msg = response.message(str(gpt_response))
176
  return PlainTextResponse(str(response), media_type="application/xml")
177
 
178