Skip to content

Commit

Permalink
fix 97971622 (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fluder-Paradyne authored Jul 20, 2023
1 parent 925fa17 commit 8e2396c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions superagi/agent/super_agi.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,15 @@ def handle_tool_response(self, session, assistant_reply):
action_name = action.name.lower().replace(" ", "") if action is not None else ""
agent = session.query(Agent).filter(Agent.id == self.agent_config["agent_id"],).first()
organisation = agent.get_agent_organisation(session)
if action_name == FINISH or action.name == "":
if action_name == FINISH or action_name == "":
logger.info("\nTask Finished :) \n")
output = {"result": "COMPLETE", "retry": False}
EventHandler(session=session).create_event('tool_used', {'tool_name':action.name}, self.agent_config["agent_id"], organisation.id),
EventHandler(session=session).create_event('tool_used', {'tool_name':action_name}, self.agent_config["agent_id"], organisation.id),
return output
if action_name in tools:
tool = tools[action_name]
retry = False
EventHandler(session=session).create_event('tool_used', {'tool_name':action.name}, self.agent_config["agent_id"], organisation.id),
EventHandler(session=session).create_event('tool_used', {'tool_name':action_name}, self.agent_config["agent_id"], organisation.id),
try:
parsed_args = self.clean_tool_args(action.args)
observation = tool.execute(parsed_args)
Expand All @@ -240,12 +240,12 @@ def handle_tool_response(self, session, assistant_reply):
)
result = f"Tool {tool.name} returned: {observation}"
output = {"result": result, "retry": retry}
elif action.name == "ERROR":
elif action_name == "ERROR":
result = f"Error2: {action.args}. "
output = {"result": result, "retry": False}
else:
result = (
f"Unknown tool '{action.name}'. "
f"Unknown tool '{action_name}'. "
f"Please refer to the 'TOOLS' list for available "
f"tools and only respond in the specified JSON format."
)
Expand Down

0 comments on commit 8e2396c

Please sign in to comment.