mirror of
https://github.com/temporal-community/temporal-ai-agent.git
synced 2026-03-15 14:08:08 +01:00
log less chatgpt stuff and actually change the goal
This commit is contained in:
@@ -237,7 +237,7 @@ class ToolActivities:
|
|||||||
)
|
)
|
||||||
|
|
||||||
response_content = chat_completion.choices[0].message.content
|
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
|
# Use the new sanitize function
|
||||||
response_content = self.sanitize_json_response(response_content)
|
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
|
# Delegate to the relevant function
|
||||||
handler = get_handler(tool_name)
|
handler = get_handler(tool_name)
|
||||||
result = handler(tool_args)
|
result = handler(tool_args)
|
||||||
|
print(f"in dynamic tool activity, result: {result}")
|
||||||
|
|
||||||
# Optionally log or augment the result
|
# Optionally log or augment the result
|
||||||
activity.logger.info(f"Tool '{tool_name}' result: {result}")
|
activity.logger.info(f"Tool '{tool_name}' result: {result}")
|
||||||
|
|||||||
@@ -115,9 +115,24 @@ class AgentGoalWorkflow:
|
|||||||
self.add_message,
|
self.add_message,
|
||||||
self.prompt_queue
|
self.prompt_queue
|
||||||
)
|
)
|
||||||
# workflow.logger.warning("last tool_data tool: ", self.tool_data[-1].tool)
|
if len(self.tool_results) > 0:
|
||||||
#workflow.logger.warning("last tool_data args: ", self.tool_data[-1].args)
|
#workflow.logger.warning("last tool_results keys: ", self.tool_results[-1].keys())
|
||||||
# workflow.logger.warning("last tool_results [args]: ", self.tool_results[-1]["args"])
|
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
|
continue
|
||||||
|
|
||||||
if self.prompt_queue:
|
if self.prompt_queue:
|
||||||
|
|||||||
Reference in New Issue
Block a user