Update utils.py
Browse files
utils.py
CHANGED
@@ -134,10 +134,9 @@ def get_question_from_summarize(summary, question, llm):
|
|
134 |
new_qa_chain = new_qa_prompt | llm
|
135 |
return new_qa_chain.invoke({'summary': summary, 'question': question}).content
|
136 |
|
137 |
-
def get_final_answer(question, context,
|
138 |
qa_prompt = ChatPromptTemplate.from_messages(
|
139 |
[
|
140 |
-
MessagesPlaceholder("chat_history"),
|
141 |
("system", prompt),
|
142 |
("human", '''
|
143 |
Context: {context}
|
@@ -149,7 +148,7 @@ def get_final_answer(question, context, chat_history, prompt, llm):
|
|
149 |
|
150 |
answer_chain = qa_prompt | llm
|
151 |
|
152 |
-
answer = answer_chain.invoke({'question': question, 'context': context
|
153 |
|
154 |
return answer.content
|
155 |
|
|
|
134 |
new_qa_chain = new_qa_prompt | llm
|
135 |
return new_qa_chain.invoke({'summary': summary, 'question': question}).content
|
136 |
|
137 |
+
def get_final_answer(question, context, prompt, llm):
|
138 |
qa_prompt = ChatPromptTemplate.from_messages(
|
139 |
[
|
|
|
140 |
("system", prompt),
|
141 |
("human", '''
|
142 |
Context: {context}
|
|
|
148 |
|
149 |
answer_chain = qa_prompt | llm
|
150 |
|
151 |
+
answer = answer_chain.invoke({'question': question, 'context': context})
|
152 |
|
153 |
return answer.content
|
154 |
|