Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass reasoning to chatters #891

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lumen/ai/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions lumen/ai/prompts/AnalystAgent/main.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
4 changes: 4 additions & 0 deletions lumen/ai/prompts/ChatAgent/main.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}
Loading