Update app.py
Browse files
app.py
CHANGED
@@ -161,10 +161,13 @@ Do not include any other text or explanation. Only return the dictionary.
|
|
161 |
|
162 |
def _generate_final_answer(self, state: AgentState) -> AgentState:
|
163 |
"""Generate the final answer based on all gathered information."""
|
|
|
|
|
|
|
164 |
history_str = "\n".join([f"{h['step']}: {h.get('output', h.get('results', h.get('error', '')))}"
|
165 |
for h in state["history"]])
|
166 |
|
167 |
-
prompt = f"""Based on the following information and history, provide a final answer to the question: {
|
168 |
|
169 |
History of steps taken:
|
170 |
{history_str}
|
|
|
161 |
|
162 |
def _generate_final_answer(self, state: AgentState) -> AgentState:
|
163 |
"""Generate the final answer based on all gathered information."""
|
164 |
+
# Get the most recent question from the list
|
165 |
+
current_question = state["question"][-1]
|
166 |
+
|
167 |
history_str = "\n".join([f"{h['step']}: {h.get('output', h.get('results', h.get('error', '')))}"
|
168 |
for h in state["history"]])
|
169 |
|
170 |
+
prompt = f"""Based on the following information and history, provide a final answer to the question: {current_question}
|
171 |
|
172 |
History of steps taken:
|
173 |
{history_str}
|