Spaces:
Build error
Build error
updated app py
Browse files
app.py
CHANGED
|
@@ -52,6 +52,7 @@ def process():
|
|
| 52 |
})
|
| 53 |
|
| 54 |
def callLlm(data):
|
|
|
|
| 55 |
pdf_folder_location = "ComplianceFile.pdf"
|
| 56 |
|
| 57 |
# Original cell: _KaqrZMObGUc
|
|
@@ -150,14 +151,15 @@ def callLlm(data):
|
|
| 150 |
|
| 151 |
# Original cell: LR4dzgL96U0-
|
| 152 |
qna_system_message = """
|
| 153 |
-
You are an assistant to a
|
| 154 |
-
|
| 155 |
This context will begin with the token: ###Context.
|
| 156 |
-
The context contains references to specific portions of a document relevant to the
|
| 157 |
-
|
| 158 |
-
Please
|
| 159 |
-
Do not mention anything about the context in your final answer. Your response should only contain the
|
| 160 |
-
|
|
|
|
| 161 |
"""
|
| 162 |
|
| 163 |
# Original cell: bDexqi8c6Xmm
|
|
@@ -165,8 +167,8 @@ def callLlm(data):
|
|
| 165 |
###Context
|
| 166 |
Here are some documents that are relevant to the question mentioned below.
|
| 167 |
{context}
|
| 168 |
-
###
|
| 169 |
-
{
|
| 170 |
"""
|
| 171 |
|
| 172 |
# Original cell: nsZuE-Xo2dAR
|
|
@@ -193,7 +195,7 @@ def callLlm(data):
|
|
| 193 |
{'role': 'system', 'content': qna_system_message},
|
| 194 |
{'role': 'user', 'content': qna_user_message_template.format(
|
| 195 |
context=context_for_query,
|
| 196 |
-
|
| 197 |
)
|
| 198 |
}
|
| 199 |
]
|
|
@@ -216,7 +218,7 @@ def callLlm(data):
|
|
| 216 |
|
| 217 |
if __name__ == '__main__':
|
| 218 |
import os
|
| 219 |
-
|
| 220 |
port = int(os.environ.get("PORT", 7860)) # Hugging Face uses port 7860
|
| 221 |
|
| 222 |
logger.info(f"Starting server on port {port}")
|
|
|
|
| 52 |
})
|
| 53 |
|
| 54 |
def callLlm(data):
|
| 55 |
+
import os
|
| 56 |
pdf_folder_location = "ComplianceFile.pdf"
|
| 57 |
|
| 58 |
# Original cell: _KaqrZMObGUc
|
|
|
|
| 151 |
|
| 152 |
# Original cell: LR4dzgL96U0-
|
| 153 |
qna_system_message = """
|
| 154 |
+
You are an assistant to a contact center human agent who checks if whatever the agent is speaking is compliant with the company policies based on the policy doc provided.
|
| 155 |
+
Agent utterances will need to be compared with the portions of relevent compliance document provided in the context and find the violations and their degree, if any.
|
| 156 |
This context will begin with the token: ###Context.
|
| 157 |
+
The context contains references to specific portions of a document relevant to the agent utterances.
|
| 158 |
+
A portion of the Transcript between the human agent and a customer will begin with the token: ###Transcript.
|
| 159 |
+
Please find policy violations only using the context provided in the input.
|
| 160 |
+
Do not mention anything about the context in your final answer. Your response should only contain the severity of the violation.
|
| 161 |
+
Pick the highest severity if multiple violations are there. Supported categories are - WARNING, ERROR and CRITICAL, in the order of lowest to highest level of violation.
|
| 162 |
+
If there are no violations, respond with "Compliant".
|
| 163 |
"""
|
| 164 |
|
| 165 |
# Original cell: bDexqi8c6Xmm
|
|
|
|
| 167 |
###Context
|
| 168 |
Here are some documents that are relevant to the question mentioned below.
|
| 169 |
{context}
|
| 170 |
+
###Transcript
|
| 171 |
+
{transcript}
|
| 172 |
"""
|
| 173 |
|
| 174 |
# Original cell: nsZuE-Xo2dAR
|
|
|
|
| 195 |
{'role': 'system', 'content': qna_system_message},
|
| 196 |
{'role': 'user', 'content': qna_user_message_template.format(
|
| 197 |
context=context_for_query,
|
| 198 |
+
transcript=user_input
|
| 199 |
)
|
| 200 |
}
|
| 201 |
]
|
|
|
|
| 218 |
|
| 219 |
if __name__ == '__main__':
|
| 220 |
import os
|
| 221 |
+
|
| 222 |
port = int(os.environ.get("PORT", 7860)) # Hugging Face uses port 7860
|
| 223 |
|
| 224 |
logger.info(f"Starting server on port {port}")
|