log less chatgpt stuff and actually change the goal

This commit is contained in:
Joshua Smith
2025-03-11 10:03:45 -04:00
parent 8fafe4b090
commit 6939e3f942
2 changed files with 20 additions and 4 deletions

View File

@@ -237,7 +237,7 @@ class ToolActivities:
)
response_content = chat_completion.choices[0].message.content
print(f"ChatGPT response: {response_content}")
activity.logger.info(f"ChatGPT response: {response_content}")
# Use the new sanitize function
response_content = self.sanitize_json_response(response_content)
@@ -449,6 +449,7 @@ def dynamic_tool_activity(args: Sequence[RawValue]) -> dict:
# Delegate to the relevant function
handler = get_handler(tool_name)
result = handler(tool_args)
print(f"in dynamic tool activity, result: {result}")
# Optionally log or augment the result
activity.logger.info(f"Tool '{tool_name}' result: {result}")

View File

@@ -115,9 +115,24 @@ class AgentGoalWorkflow:
self.add_message,
self.prompt_queue
)
# workflow.logger.warning("last tool_data tool: ", self.tool_data[-1].tool)
#workflow.logger.warning("last tool_data args: ", self.tool_data[-1].args)
# workflow.logger.warning("last tool_results [args]: ", self.tool_results[-1]["args"])
if len(self.tool_results) > 0:
#workflow.logger.warning("last tool_results keys: ", self.tool_results[-1].keys())
workflow.logger.warning(f"last tool_results keys: {self.tool_results[-1].keys()}")
workflow.logger.warning(f"last tool_results values:{ self.tool_results[-1].values()}")
if "new_goal" in self.tool_results[-1].keys() and "ChangeGoal" in self.tool_results[-1].values():
new_goal = self.tool_results[-1].get("new_goal")
workflow.logger.warning(f"Booya new goal!: {new_goal}")
goals = {
"goal_match_train_invoice": goal_match_train_invoice,
"goal_event_flight_invoice": goal_event_flight_invoice,
"goal_choose_agent_type": goal_choose_agent_type,
}
if new_goal is not None:
self.goal = goals.get(new_goal)
#todo reset goal or tools if this doesn't work or whatever
else:
workflow.logger.warning("no tool results yet")
continue
if self.prompt_queue: