Spaces:
Running
Running
ryanrwatkins
commited on
Commit
•
722f026
1
Parent(s):
c5879fd
Update app.py
Browse files
app.py
CHANGED
@@ -631,7 +631,7 @@ memory.load_memory_variables({})
|
|
631 |
|
632 |
|
633 |
standalone_question_template = """Given the following conversation and a follow up question,
|
634 |
-
rephrase the follow up question to be a standalone question, in
|
635 |
Chat History:\n{chat_history}\n
|
636 |
Follow Up Input: {question}\n
|
637 |
Standalone question: {question}"""
|
@@ -646,7 +646,7 @@ def answer_template(language="english"):
|
|
646 |
"""Pass the standalone question along with the chat history and context
|
647 |
to the `LLM` wihch will answer"""
|
648 |
|
649 |
-
template = f"""Answer the question at the end, using only the following context (delimited by <context></context>).
|
650 |
Your answer must be in the language at the end.
|
651 |
|
652 |
<context>
|
@@ -664,13 +664,7 @@ def answer_template(language="english"):
|
|
664 |
answer_prompt = ChatPromptTemplate.from_template(answer_template())
|
665 |
|
666 |
|
667 |
-
|
668 |
-
|
669 |
-
|
670 |
-
|
671 |
-
|
672 |
-
|
673 |
-
|
674 |
# invoke the ChatPromptTemplate
|
675 |
answer_prompt.invoke(
|
676 |
{"question":"plaese ",
|
@@ -678,7 +672,7 @@ answer_prompt.invoke(
|
|
678 |
"chat_history":memory.chat_memory}
|
679 |
)
|
680 |
|
681 |
-
|
682 |
|
683 |
|
684 |
|
|
|
631 |
|
632 |
|
633 |
standalone_question_template = """Given the following conversation and a follow up question,
|
634 |
+
rephrase the follow up question to be a standalone question, in the English language.\n\n
|
635 |
Chat History:\n{chat_history}\n
|
636 |
Follow Up Input: {question}\n
|
637 |
Standalone question: {question}"""
|
|
|
646 |
"""Pass the standalone question along with the chat history and context
|
647 |
to the `LLM` wihch will answer"""
|
648 |
|
649 |
+
template = f"""Answer the question (convert to {language} language if it is not) at the end, using only the following context (delimited by <context></context>).
|
650 |
Your answer must be in the language at the end.
|
651 |
|
652 |
<context>
|
|
|
664 |
answer_prompt = ChatPromptTemplate.from_template(answer_template())
|
665 |
|
666 |
|
667 |
+
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
668 |
# invoke the ChatPromptTemplate
|
669 |
answer_prompt.invoke(
|
670 |
{"question":"plaese ",
|
|
|
672 |
"chat_history":memory.chat_memory}
|
673 |
)
|
674 |
|
675 |
+
"""
|
676 |
|
677 |
|
678 |
|