Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
|
@@ -72,7 +72,27 @@ async def chat(query,history,sources,reports):
|
|
| 72 |
# get prompt
|
| 73 |
|
| 74 |
#prompt = ChatPromptTemplate.from_template(answer_prompt_template)
|
| 75 |
-
prompt = ChatPromptTemplate.from_messages(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
# get llm_qa
|
| 78 |
# llm_qa = HuggingFaceEndpoint(
|
|
|
|
| 72 |
# get prompt
|
| 73 |
|
| 74 |
#prompt = ChatPromptTemplate.from_template(answer_prompt_template)
|
| 75 |
+
prompt = ChatPromptTemplate.from_messages([
|
| 76 |
+
(
|
| 77 |
+
"system",
|
| 78 |
+
"""You are AuditQ&A, an AI Assistant created by Auditors and Data Scientist. You are given a question and extracted passages of the consolidated/departmental/thematic focus audit reports. Provide a clear and structured answer based on the passages provided, the context and the guidelines.
|
| 79 |
+
Guidelines:
|
| 80 |
+
- If the passages have useful facts or numbers, use them in your answer.
|
| 81 |
+
- When you use information from a passage, mention where it came from by using [Doc i] at the end of the sentence. i stands for the number of the document.
|
| 82 |
+
- Do not use the sentence 'Doc i says ...' to say where information came from.
|
| 83 |
+
- If the same thing is said in more than one document, you can mention all of them like this: [Doc i, Doc j, Doc k]
|
| 84 |
+
- Do not just summarize each passage one by one. Group your summaries to highlight the key parts in the explanation.
|
| 85 |
+
- If it makes sense, use bullet points and lists to make your answers easier to understand.
|
| 86 |
+
- You do not need to use every passage. Only use the ones that help answer the question.
|
| 87 |
+
- If the documents do not have the information needed to answer the question, just say you do not have enough information.""",
|
| 88 |
+
),
|
| 89 |
+
("user",
|
| 90 |
+
"""Passages:
|
| 91 |
+
{context}
|
| 92 |
+
-----------------------
|
| 93 |
+
Question: {question} - Explained to {audience}
|
| 94 |
+
Answer in {language} with the passages citations:"""),
|
| 95 |
+
])
|
| 96 |
|
| 97 |
# get llm_qa
|
| 98 |
# llm_qa = HuggingFaceEndpoint(
|