Spaces:
Running
on
Zero
Running
on
Zero
Update utils/prompts.py
Browse files- utils/prompts.py +5 -21
utils/prompts.py
CHANGED
|
@@ -1,31 +1,15 @@
|
|
| 1 |
def format_rag_prompt( query: str, context: str, accepts_sys: bool) -> str:
|
| 2 |
system_prompt = """
|
| 3 |
-
|
| 4 |
"""
|
| 5 |
-
# If the full, complete answer to the query cannot be found in the context, answer what the context allows you to answer and indicate clearly where additional information is needed.
|
| 6 |
-
# If the none of the answer can be found, clearly refuse to answer, and ask for more relevant information from the user.
|
| 7 |
-
|
| 8 |
-
# The output should not contain your judgment on answerability, only your answer OR your refusal + clarifications.
|
| 9 |
-
|
| 10 |
-
# Stay within the bounds of the provided context and avoid making assumptions.
|
| 11 |
|
| 12 |
-
user_prompt = f"""
|
| 13 |
-
You will be given a Query and a few documents. Your task is to provide an answer to the Query based only on the documents.
|
| 14 |
-
Try to address all aspects of the query, but if certain parts are not answerable, answer what you can and indicate clearly where additional information is needed.
|
| 15 |
-
Do not use information not present in the documents to answer the query.
|
| 16 |
-
|
| 17 |
-
If the documents cannot answer any part of the Query, clearly refuse to answer, and ask for more relevant information from the user.
|
| 18 |
-
You should give a concise explanation of why you cannot answer the query based on the documents, and ask for more relevant information from the user.
|
| 19 |
-
|
| 20 |
-
## Query:
|
| 21 |
-
|
| 22 |
-
{query}
|
| 23 |
|
| 24 |
-
|
| 25 |
|
| 26 |
-
{
|
| 27 |
|
| 28 |
-
|
| 29 |
"""
|
| 30 |
|
| 31 |
messages = (
|
|
|
|
| 1 |
def format_rag_prompt( query: str, context: str, accepts_sys: bool) -> str:
|
| 2 |
system_prompt = """
|
| 3 |
+
Answer this question based on search result. If you CAN NOT answer, please tell me why and ask for clarification for the query.
|
| 4 |
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
user_prompt = f"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
Search result: {context}
|
| 9 |
|
| 10 |
+
Question: {query}
|
| 11 |
|
| 12 |
+
Answer:
|
| 13 |
"""
|
| 14 |
|
| 15 |
messages = (
|