Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,12 +1,3 @@
|
|
1 |
-
# ---------------------------------------------------for backend looks-------------------------------------------------
|
2 |
-
|
3 |
-
#with open('/usr/local/lib/python3.10/site-packages/transformers/utils/chat_template_utils.py', 'r') as file:
|
4 |
-
#content = file.read()
|
5 |
-
#print("base.py:", content)
|
6 |
-
# ------------------------------------------------------the end--------------------------------------------------------
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
# ===========================================
|
11 |
# !-----app.py
|
12 |
# ===========================================
|
@@ -31,14 +22,12 @@ auth_token = os.environ.get("DAYSOFF_API_TOKEN")
|
|
31 |
|
32 |
API_URL = "https://aivisions.no/data/daysoff/api/v1/booking/"
|
33 |
|
34 |
-
|
35 |
daysoff_assistant_template = """
|
36 |
#You are a customer support assistant (โkundeservice AI assistentโ) for Daysoff.
|
37 |
#By default, you respond in Norwegian language, using a warm, direct, and professional tone.
|
38 |
Your expertise is exclusively in retrieving booking information for a given booking ID and assistance related to
|
39 |
to this.
|
40 |
#You should always provide a clear and concise answer (in Norwegian) of the booking information retrieved.
|
41 |
-
#The best way to ensure professionalism and relevance is to ppresent the answer in a markdown table.
|
42 |
#This way you directly address the user's question in a manner that reflects the professionalism and warmth
|
43 |
#of a human customer service agent.
|
44 |
You do not provide information outside of this scope. If a question is not about this topic, adapt to user's query
|
@@ -54,7 +43,7 @@ daysoff_assistant_prompt = PromptTemplate(
|
|
54 |
template=daysoff_assistant_template,
|
55 |
)
|
56 |
|
57 |
-
#
|
58 |
async def async_post_request(url, headers, data):
|
59 |
return await asyncio.to_thread(requests.post, url, headers=headers, json=data)
|
60 |
|
@@ -78,7 +67,6 @@ def setup_multiple_chains():
|
|
78 |
return_messages=True
|
79 |
)
|
80 |
|
81 |
-
|
82 |
llm_chain = LLMChain(
|
83 |
llm=llm,
|
84 |
prompt=daysoff_assistant_prompt,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# ===========================================
|
2 |
# !-----app.py
|
3 |
# ===========================================
|
|
|
22 |
|
23 |
API_URL = "https://aivisions.no/data/daysoff/api/v1/booking/"
|
24 |
|
|
|
25 |
daysoff_assistant_template = """
|
26 |
#You are a customer support assistant (โkundeservice AI assistentโ) for Daysoff.
|
27 |
#By default, you respond in Norwegian language, using a warm, direct, and professional tone.
|
28 |
Your expertise is exclusively in retrieving booking information for a given booking ID and assistance related to
|
29 |
to this.
|
30 |
#You should always provide a clear and concise answer (in Norwegian) of the booking information retrieved.
|
|
|
31 |
#This way you directly address the user's question in a manner that reflects the professionalism and warmth
|
32 |
#of a human customer service agent.
|
33 |
You do not provide information outside of this scope. If a question is not about this topic, adapt to user's query
|
|
|
43 |
template=daysoff_assistant_template,
|
44 |
)
|
45 |
|
46 |
+
# -- async wrapper for requests.post
|
47 |
async def async_post_request(url, headers, data):
|
48 |
return await asyncio.to_thread(requests.post, url, headers=headers, json=data)
|
49 |
|
|
|
67 |
return_messages=True
|
68 |
)
|
69 |
|
|
|
70 |
llm_chain = LLMChain(
|
71 |
llm=llm,
|
72 |
prompt=daysoff_assistant_prompt,
|