diff --git a/lumen/ai/coordinator.py b/lumen/ai/coordinator.py index 985ea309..78af4f24 100644 --- a/lumen/ai/coordinator.py +++ b/lumen/ai/coordinator.py @@ -722,6 +722,7 @@ async def _make_plan( max_retries=3, ) if reasoning.chain_of_thought: # do not replace with empty string + self._memory["reasoning"] = reasoning.chain_of_thought step.stream(reasoning.chain_of_thought, replace=True) previous_plans.append(reasoning.chain_of_thought) requested = [ @@ -851,7 +852,7 @@ async def _compute_execution_graph(self, messages: list[Message], agents: dict[s if attempts > 5: istep.failed_title = "Planning failed to come up with viable plan, please restate the problem and try again." raise RuntimeError("Planner failed to come up with viable plan after 5 attempts.") - self._memory['plan'] = plan + self._memory["plan"] = plan istep.stream('\n\nHere are the steps:\n\n') for i, step in enumerate(plan.steps): istep.stream(f"{i+1}. {step.expert_or_tool}: {step.instruction}\n") diff --git a/lumen/ai/prompts/AnalystAgent/main.jinja2 b/lumen/ai/prompts/AnalystAgent/main.jinja2 index efc916c2..9c4ad581 100644 --- a/lumen/ai/prompts/AnalystAgent/main.jinja2 +++ b/lumen/ai/prompts/AnalystAgent/main.jinja2 @@ -20,4 +20,8 @@ Here is the current SQL query: Here is the current dataset: {{ memory.data }} +Here was the plan that was executed: +""" +{{ memory.reasoning }} +""" {% endblock %} diff --git a/lumen/ai/prompts/ChatAgent/main.jinja2 b/lumen/ai/prompts/ChatAgent/main.jinja2 index 7d0abe48..5b6dde27 100644 --- a/lumen/ai/prompts/ChatAgent/main.jinja2 +++ b/lumen/ai/prompts/ChatAgent/main.jinja2 @@ -21,4 +21,8 @@ Available table schemas: {% elif table is defined and schema is defined %} - `{{ table }}`: {{ schema }} {% endif -%} +Here was the plan that was executed: +""" +{{ memory.reasoning }} +""" {% endblock -%}