Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,9 @@ import time
|
|
8 |
import json
|
9 |
import torch
|
10 |
|
11 |
-
from api_docs_mck import api_docs_str
|
|
|
|
|
12 |
|
13 |
import chainlit as cl
|
14 |
|
@@ -68,9 +70,9 @@ api_url_prompt = PromptTemplate(input_variables=['api_docs', 'question'],
|
|
68 |
template=api_url_template)
|
69 |
|
70 |
api_response_template = """
|
71 |
-
IF and only IF {question} contains alphanumeric identifier
|
72 |
-
with the API Documentation for Daysoff's official API: {api_docs}
|
73 |
-
|
74 |
response from Daysoff's API: {api_response}.
|
75 |
Please provide only information that directly addresses the user's question,
|
76 |
omitting technical details like response format, and
|
@@ -142,6 +144,3 @@ async def handle_message(message: cl.Message):
|
|
142 |
response_key = "output" if "output" in response else "text"
|
143 |
await cl.Message(response.get(response_key, "")).send()
|
144 |
return message.content
|
145 |
-
|
146 |
-
# await cl.Message(response.get(response_key, "")).send()
|
147 |
-
# content=f"Her er informasjonen for bestillingsnummer {booking_id}:\n{booking_info}").send()
|
|
|
8 |
import json
|
9 |
import torch
|
10 |
|
11 |
+
from api_docs_mck import api_docs_str
|
12 |
+
#from daysoff import daysoff_str ## make daysoff.py, put json info in dict.
|
13 |
+
#from personvernpolicy import personvernpolicy_str ## make personvernpolicy.py, put json info in dict.
|
14 |
|
15 |
import chainlit as cl
|
16 |
|
|
|
70 |
template=api_url_template)
|
71 |
|
72 |
api_response_template = """
|
73 |
+
IF and only IF {question} contains an alphanumeric identifier with regex pattern "^[A-Z]{6}\\d{6}$",
|
74 |
+
with the API Documentation for Daysoff's official API: {api_docs} in mind,
|
75 |
+
and given this API URL: {api_url} for querying, here is the
|
76 |
response from Daysoff's API: {api_response}.
|
77 |
Please provide only information that directly addresses the user's question,
|
78 |
omitting technical details like response format, and
|
|
|
144 |
response_key = "output" if "output" in response else "text"
|
145 |
await cl.Message(response.get(response_key, "")).send()
|
146 |
return message.content
|
|
|
|
|
|