camparchimedes commited on
Commit
9dc4afe
ยท
verified ยท
1 Parent(s): 9479063

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -4
app.py CHANGED
@@ -61,7 +61,7 @@ a booking ID (โ€™bestillingskodeโ€™): {api_response},
61
  please directly address the user's question (in Norwegian) and focus on delivering the
62
  the response from Daysoff's API in a markdown table with clarity
63
  and conciseness.
64
- Reply:
65
  """
66
 
67
  api_response_prompt = PromptTemplate(
@@ -115,7 +115,7 @@ async def handle_message(message: cl.Message):
115
 
116
 
117
  if re.search(booking_pattern, user_message):
118
- bestillingskode = re.search(booking_pattern, user_message).group(0)
119
  question = f"Retrieve information for booking ID {base_url}?search={bestillingskode}"
120
 
121
  response = await api_chain.acall(
@@ -126,8 +126,26 @@ async def handle_message(message: cl.Message):
126
  },
127
  callbacks=[cl.AsyncLangchainCallbackHandler()])
128
 
129
- else:
130
- response = await llm_chain.acall(user_message, callbacks=[cl.AsyncLangchainCallbackHandler()])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
  response_key = "output" if "output" in response else "text"
133
  await cl.Message(response.get(response_key, "")).send()
 
61
  please directly address the user's question (in Norwegian) and focus on delivering the
62
  the response from Daysoff's API in a markdown table with clarity
63
  and conciseness.
64
+ Response:
65
  """
66
 
67
  api_response_prompt = PromptTemplate(
 
115
 
116
 
117
  if re.search(booking_pattern, user_message):
118
+ bestillingskode = re.search(booking_pattern, user_message)#.group(0)
119
  question = f"Retrieve information for booking ID {base_url}?search={bestillingskode}"
120
 
121
  response = await api_chain.acall(
 
126
  },
127
  callbacks=[cl.AsyncLangchainCallbackHandler()])
128
 
129
+ else:
130
+
131
+ help = help #()
132
+ help2 = help2 #()()
133
+
134
+ # --psass required inputs to llm chain
135
+ response = await llm_chain.acall(
136
+ {
137
+ #"chat_history": [],
138
+ "question": user_message,
139
+ "help": help,
140
+ "help2": help2,
141
+ "ansatte_faq_data": ansatte_faq_data,
142
+ "utleiere_faq_data": utleiere_faq_data,
143
+ "personvernspolicy_data": personvernspolicy_data
144
+ },
145
+ callbacks=[cl.AsyncLangchainCallbackHandler()]
146
+ )
147
+
148
+ #response = await llm_chain.acall(user_message, callbacks=[cl.AsyncLangchainCallbackHandler()])
149
 
150
  response_key = "output" if "output" in response else "text"
151
  await cl.Message(response.get(response_key, "")).send()