From b395a438d041ed3d84faa3db9f18496b4517e264 Mon Sep 17 00:00:00 2001 From: Debanjum Date: Thu, 8 May 2025 23:35:11 -0600 Subject: [PATCH] Fix handling multiple actions requested by grounding agent in an iteration --- .../processor/operator/operator_agent_binary.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/khoj/processor/operator/operator_agent_binary.py b/src/khoj/processor/operator/operator_agent_binary.py index 6f99afb6..61f3de73 100644 --- a/src/khoj/processor/operator/operator_agent_binary.py +++ b/src/khoj/processor/operator/operator_agent_binary.py @@ -221,12 +221,15 @@ Focus on the visual action and provide all necessary context. else: message = f"**Action Result**: {json.dumps(result_content)}" images = [] - action_result["content"] = construct_structured_message( - message=message, - images=images, - model_type=self.reasoning_model.model_type, - vision_enabled=True, - ) + if not images: + action_result["content"] = [{"type": "text", "text": message}] + else: + action_result["content"] = construct_structured_message( + message=message, + images=images, + model_type=self.reasoning_model.model_type, + vision_enabled=True, + ) # Append action results to history action_results_content = []