camparchimedes commited on
Commit
52b624f
ยท
verified ยท
1 Parent(s): 6c97556

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -10
app.py CHANGED
@@ -24,10 +24,10 @@ OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")
24
  daysoff_assistant_template = """
25
  You are a customer support assistant (โ€™kundeservice AI assistentโ€™) for Daysoff.no
26
  By default, you respond in Norwegian language, using a warm, direct and professional tone.
27
- You can provide information associated with a given booking ID, answer frequently asked questions (FAQ) about DaysOff firmahytteordning for
28
- employees: {ansatte_faq_data} and for employers:{utleiere_faq_data}.
29
- To understand how best to answer queries about privacy policy,
30
- refer to {help2} and {personvernspolicy_data}
31
  Chat History: {chat_history}
32
  Question: {question}
33
  Answer:
@@ -59,12 +59,6 @@ and focusing on delivering the answer with clarity and conciseness,
59
  as if a human customer service agent is providing this information.
60
  Summary:
61
  """
62
- ## --"default"
63
- #Please provide an summary (in Norwegian) that directly addresses the user's question,
64
- #and focusing on delivering the answer with clarity and conciseness,
65
- #as if a human customer service agent is providing this information.
66
- #Summary:
67
-
68
 
69
  api_response_prompt = PromptTemplate(
70
  input_variables=['api_docs', 'question', 'api_url', 'api_response'],
@@ -126,7 +120,13 @@ async def handle_message(message: cl.Message):
126
 
127
  },
128
  callbacks=[cl.AsyncLangchainCallbackHandler()])
 
 
 
129
 
 
 
 
130
  else:
131
  response = await llm_chain.acall(user_message, callbacks=[cl.AsyncLangchainCallbackHandler()])
132
 
 
24
  daysoff_assistant_template = """
25
  You are a customer support assistant (โ€™kundeservice AI assistentโ€™) for Daysoff.no
26
  By default, you respond in Norwegian language, using a warm, direct and professional tone.
27
+ You are equipped to assist users by providing detailed information linked to specific
28
+ booking IDs (bestillingskode), offering general insights about DaysOff's services, addressing
29
+ questions related to the company's privacy policy (personvernspolicy), and answering frequently
30
+ asked questions about DaysOff's firmahytteordning.
31
  Chat History: {chat_history}
32
  Question: {question}
33
  Answer:
 
59
  as if a human customer service agent is providing this information.
60
  Summary:
61
  """
 
 
 
 
 
 
62
 
63
  api_response_prompt = PromptTemplate(
64
  input_variables=['api_docs', 'question', 'api_url', 'api_response'],
 
120
 
121
  },
122
  callbacks=[cl.AsyncLangchainCallbackHandler()])
123
+
124
+ elif any(keyword in user_message for keyword in ["firmahytteordning", "personvernspolicy",
125
+ "faq_ansatte", "faq_utleiere"]):
126
 
127
+ response = await api_chain.acall(user_message,
128
+ callbacks=[cl.AsyncLangchainCallbackHandler()])
129
+
130
  else:
131
  response = await llm_chain.acall(user_message, callbacks=[cl.AsyncLangchainCallbackHandler()])
132