Spaces:
Build error
Build error
Update query_data.py
Browse files- query_data.py +4 -4
query_data.py
CHANGED
|
@@ -15,7 +15,7 @@ from langchain.schema import (
|
|
| 15 |
SystemMessage
|
| 16 |
)
|
| 17 |
|
| 18 |
-
system_template = """Use the following pieces of context to answer the
|
| 19 |
If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
| 20 |
----------------
|
| 21 |
{context}"""
|
|
@@ -27,7 +27,7 @@ messages = [
|
|
| 27 |
prompt = ChatPromptTemplate.from_messages(messages)
|
| 28 |
|
| 29 |
_template = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question.
|
| 30 |
-
You can assume the question about the
|
| 31 |
|
| 32 |
Chat History:
|
| 33 |
{chat_history}
|
|
@@ -35,10 +35,10 @@ Follow Up Input: {question}
|
|
| 35 |
Standalone question:"""
|
| 36 |
CONDENSE_QUESTION_PROMPT = PromptTemplate.from_template(_template)
|
| 37 |
|
| 38 |
-
#template = """You are an AI assistant for answering questions about
|
| 39 |
#You are given the following extracted parts of a long document and a question. Provide a conversational answer.
|
| 40 |
#If you don't know the answer, just say "Hmm, I'm not sure." Don't try to make up an answer.
|
| 41 |
-
#If the question is not about
|
| 42 |
#Question: {question}
|
| 43 |
#=========
|
| 44 |
#{context}
|
|
|
|
| 15 |
SystemMessage
|
| 16 |
)
|
| 17 |
|
| 18 |
+
system_template = """Use the following pieces of context to answer the user's question. Use only the context to answer the question.
|
| 19 |
If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
| 20 |
----------------
|
| 21 |
{context}"""
|
|
|
|
| 27 |
prompt = ChatPromptTemplate.from_messages(messages)
|
| 28 |
|
| 29 |
_template = """Given the following conversation and a follow up question, rephrase the follow up question to be a standalone question.
|
| 30 |
+
You can assume the question about the law case between Review Publishing Company Limited and Lee Hsien Loong in Singapore.
|
| 31 |
|
| 32 |
Chat History:
|
| 33 |
{chat_history}
|
|
|
|
| 35 |
Standalone question:"""
|
| 36 |
CONDENSE_QUESTION_PROMPT = PromptTemplate.from_template(_template)
|
| 37 |
|
| 38 |
+
#template = """You are an AI assistant for answering questions about the law case.
|
| 39 |
#You are given the following extracted parts of a long document and a question. Provide a conversational answer.
|
| 40 |
#If you don't know the answer, just say "Hmm, I'm not sure." Don't try to make up an answer.
|
| 41 |
+
#If the question is not about law, politely inform them that you are tuned to only answer questions about it.
|
| 42 |
#Question: {question}
|
| 43 |
#=========
|
| 44 |
#{context}
|