From a64fef9b8f611c9cf04ef31a48465202c2edfb01 Mon Sep 17 00:00:00 2001 From: mudler Date: Sat, 5 Aug 2023 17:54:31 +0200 Subject: [PATCH] Better force-action --- main.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 7d5f649..6b3b542 100644 --- a/main.py +++ b/main.py @@ -644,6 +644,13 @@ def evaluate(user_input, conversation_history = [],re_evaluate=False, agent_acti # action_picker_message += "\n" action_picker_message = "Request: "+user_input + picker_actions = agent_actions + if args.force_action: + aa = {} + aa[args.force_action] = agent_actions[args.force_action] + picker_actions = aa + logger.info("==> Forcing action to '{action}' as requested by the user", action=args.force_action) + #if re_evaluate and not re_evaluation_in_progress: # observation = analyze(conversation_history, prefix=True) # action_picker_message+="\n\Thought: "+observation[-1]["content"] @@ -654,7 +661,7 @@ def evaluate(user_input, conversation_history = [],re_evaluate=False, agent_acti action_picker_message+="\n\nObservation: "+observation # if there is no action to do, we can just reply to the user with REPLY_ACTION try: - action = needs_to_do_action(action_picker_message,agent_actions=agent_actions) + action = needs_to_do_action(action_picker_message,agent_actions=picker_actions) except Exception as e: logger.error("==> error: ") logger.error(e) @@ -665,9 +672,6 @@ def evaluate(user_input, conversation_history = [],re_evaluate=False, agent_acti #logger.info("==> Observation '{reasoning}'", reasoning=action["observation"]) logger.info("==> Reasoning '{reasoning}'", reasoning=action["reasoning"]) # Force executing a plan instead - if args.force_action: - action["action"] = args.force_action - logger.info("==> Forcing action to '{action}' as requested by the user", action=action["action"]) reasoning = action["reasoning"] if action["action"] == PLAN_ACTION: