camparchimedes commited on
Commit
adafc06
·
verified ·
1 Parent(s): 0b2d953

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -9
app.py CHANGED
@@ -66,7 +66,9 @@ daysoff_assistant_template = """
66
  You are a customer support assistant (’kundeservice AI assistent’) for Daysoff.no
67
  By default, you respond in Norwegian language, using a warm, direct and professional tone.
68
  You can look up booking information for a booking ID (bestillingskode)
69
- and answer frequently-asked-questions about Daysoff'
 
 
70
  Chat History: {chat_history}
71
  Question: {question}
72
  Answer:
@@ -97,8 +99,7 @@ If the response includes a booking ID (bestillingskode), consistently present th
97
  directly to the user without summarizing it.
98
  For all other responses, please provide a clear and concise summary (in Norwegian) that directly addresses the user's question,
99
  delivered in a manner that reflects the professionalism and warmth of a human customer service agent.
100
- If you do not know the answer, just reply truthfully that you do not have the answer rather than
101
- giving inaccurate or speculative information.
102
  Summary:
103
  """
104
 
@@ -151,11 +152,11 @@ async def handle_message(message: cl.Message):
151
  booking_pattern = r'\b[A-Z]{6}\d{6}\b'
152
  base_url = "https://670dccd0073307b4ee447f2f.mockapi.io/daysoff/api/V1/booking"
153
 
154
- faq_keywords = (
155
- [key for key in ansatte_faq_data.keys()] +
156
- [key for key in utleiere_faq_data.keys()] +
157
- [key for key in personvernspolicy_data.keys()]
158
- )
159
 
160
  if re.search(booking_pattern, user_message):
161
  bestillingskode = re.search(booking_pattern, user_message).group(0)
@@ -169,8 +170,9 @@ async def handle_message(message: cl.Message):
169
  },
170
  callbacks=[cl.AsyncLangchainCallbackHandler()])
171
 
172
- elif any(keyword in user_message for keyword in faq_keywords):
173
 
 
174
  response = await api_chain.acall(user_message, callbacks=[cl.AsyncLangchainCallbackHandler()])
175
 
176
  else:
 
66
  You are a customer support assistant (’kundeservice AI assistent’) for Daysoff.no
67
  By default, you respond in Norwegian language, using a warm, direct and professional tone.
68
  You can look up booking information for a booking ID (bestillingskode)
69
+ and answer FAQ (spørsmål og svar vi ofte får fra ansatte og utleiere) about DaysOff firmahytteordning.
70
+ If you do not know the answer, just reply truthfully that you do not have the answer rather than
71
+ giving inaccurate or speculative information.
72
  Chat History: {chat_history}
73
  Question: {question}
74
  Answer:
 
99
  directly to the user without summarizing it.
100
  For all other responses, please provide a clear and concise summary (in Norwegian) that directly addresses the user's question,
101
  delivered in a manner that reflects the professionalism and warmth of a human customer service agent.
102
+
 
103
  Summary:
104
  """
105
 
 
152
  booking_pattern = r'\b[A-Z]{6}\d{6}\b'
153
  base_url = "https://670dccd0073307b4ee447f2f.mockapi.io/daysoff/api/V1/booking"
154
 
155
+ #faq_keywords = (
156
+ #[key for key in ansatte_faq_data.keys()] +
157
+ #[key for key in utleiere_faq_data.keys()] +
158
+ #[key for key in personvernspolicy_data.keys()]
159
+ #)
160
 
161
  if re.search(booking_pattern, user_message):
162
  bestillingskode = re.search(booking_pattern, user_message).group(0)
 
170
  },
171
  callbacks=[cl.AsyncLangchainCallbackHandler()])
172
 
173
+ elif any(keyword in user_message for keyword in (FAQ_ANSATTE + FAQ_UTLEIERE + PERSONVERNSPOLICY_QUESTIONS)):
174
 
175
+ #elif any(keyword in user_message for keyword in faq_keywords):
176
  response = await api_chain.acall(user_message, callbacks=[cl.AsyncLangchainCallbackHandler()])
177
 
178
  else: