Update handler.py
Browse files- handler.py +3 -2
handler.py
CHANGED
@@ -68,6 +68,7 @@ class EndpointHandler():
|
|
68 |
{chat_history}
|
69 |
Follow Up Input: {question}
|
70 |
Standalone question:"""
|
|
|
71 |
CONDENSE_QUESTION_PROMPT = PromptTemplate.from_template(_template)
|
72 |
|
73 |
template = """Answer the question based only on the following context:
|
@@ -93,7 +94,7 @@ class EndpointHandler():
|
|
93 |
"chat_history": lambda x: get_buffer_string(x["chat_history"]),
|
94 |
}
|
95 |
| CONDENSE_QUESTION_PROMPT
|
96 |
-
|
|
97 |
| StrOutputParser(),
|
98 |
}
|
99 |
# Now we retrieve the documents
|
@@ -108,7 +109,7 @@ class EndpointHandler():
|
|
108 |
}
|
109 |
# And finally, we do the part that returns the answers
|
110 |
answer = {
|
111 |
-
"answer": final_inputs | ANSWER_PROMPT |
|
112 |
"docs": itemgetter("docs"),
|
113 |
}
|
114 |
# And now we put it all together!
|
|
|
68 |
{chat_history}
|
69 |
Follow Up Input: {question}
|
70 |
Standalone question:"""
|
71 |
+
|
72 |
CONDENSE_QUESTION_PROMPT = PromptTemplate.from_template(_template)
|
73 |
|
74 |
template = """Answer the question based only on the following context:
|
|
|
94 |
"chat_history": lambda x: get_buffer_string(x["chat_history"]),
|
95 |
}
|
96 |
| CONDENSE_QUESTION_PROMPT
|
97 |
+
| chat(temperature=0)
|
98 |
| StrOutputParser(),
|
99 |
}
|
100 |
# Now we retrieve the documents
|
|
|
109 |
}
|
110 |
# And finally, we do the part that returns the answers
|
111 |
answer = {
|
112 |
+
"answer": final_inputs | ANSWER_PROMPT | chat,
|
113 |
"docs": itemgetter("docs"),
|
114 |
}
|
115 |
# And now we put it all together!
|