mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-06 19:15:28 +00:00
fix : planner not passing info properly between agents
This commit is contained in:
parent
5dd3ffd9ef
commit
1027a2a77b
@ -63,6 +63,8 @@ class PlannerAgent(Agent):
|
|||||||
return zip(tasks_names, tasks)
|
return zip(tasks_names, tasks)
|
||||||
|
|
||||||
def make_prompt(self, task, needed_infos):
|
def make_prompt(self, task, needed_infos):
|
||||||
|
if needed_infos is None:
|
||||||
|
needed_infos = "No needed informations."
|
||||||
prompt = f"""
|
prompt = f"""
|
||||||
You are given the following informations:
|
You are given the following informations:
|
||||||
{needed_infos}
|
{needed_infos}
|
||||||
@ -96,20 +98,21 @@ class PlannerAgent(Agent):
|
|||||||
agents_tasks = self.parse_agent_tasks(answer)
|
agents_tasks = self.parse_agent_tasks(answer)
|
||||||
if agents_tasks == (None, None):
|
if agents_tasks == (None, None):
|
||||||
return "Failed to parse the tasks", reasoning
|
return "Failed to parse the tasks", reasoning
|
||||||
|
prev_agent_answer = None
|
||||||
for task_name, task in agents_tasks:
|
for task_name, task in agents_tasks:
|
||||||
pretty_print(f"I will {task_name}.", color="info")
|
pretty_print(f"I will {task_name}.", color="info")
|
||||||
agent_prompt = self.make_prompt(task['task'], task['need'])
|
agent_prompt = self.make_prompt(task['task'], prev_agent_answer)
|
||||||
pretty_print(f"Assigned agent {task['agent']} to {task_name}", color="info")
|
pretty_print(f"Assigned agent {task['agent']} to {task_name}", color="info")
|
||||||
if speech_module: speech_module.speak(f"I will {task_name}. I assigned the {task['agent']} agent to the task.")
|
if speech_module: speech_module.speak(f"I will {task_name}. I assigned the {task['agent']} agent to the task.")
|
||||||
try:
|
try:
|
||||||
self.agents[task['agent'].lower()].process(agent_prompt, speech_module)
|
prev_agent_answer, _ = self.agents[task['agent'].lower()].process(agent_prompt, speech_module)
|
||||||
pretty_print(f"-- Agent answer ---\n\n", color="output")
|
pretty_print(f"-- Agent answer ---\n\n", color="output")
|
||||||
self.agents[task['agent'].lower()].show_answer()
|
self.agents[task['agent'].lower()].show_answer()
|
||||||
pretty_print(f"\n\n", color="output")
|
pretty_print(f"\n\n", color="output")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise e
|
raise e
|
||||||
self.last_answer = answer
|
self.last_answer = prev_agent_answer
|
||||||
return answer, reasoning
|
return prev_agent_answer, reasoning
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
from llm_provider import Provider
|
from llm_provider import Provider
|
||||||
|
Loading…
x
Reference in New Issue
Block a user