From db08f24271a3da9337e42b6349cf1b821eb076b1 Mon Sep 17 00:00:00 2001 From: "D. Seifert" Date: Mon, 14 Oct 2024 17:51:48 +0800 Subject: [PATCH] more possible manual intervention --- sweagent/agent/agents.py | 11 ++++++++--- sweagent/environment/swe_env.py | 2 -- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/sweagent/agent/agents.py b/sweagent/agent/agents.py index efd562eb3..2288044e0 100644 --- a/sweagent/agent/agents.py +++ b/sweagent/agent/agents.py @@ -23,15 +23,15 @@ ModelQueryResult, get_last_valid_tool_use_name, get_model, - make_model_query_result, make_assistant_content, + make_model_query_result, make_user_reply_content, ) from sweagent.agent.parsing import FormatError, ParseFunction from sweagent.environment.swe_env import SWEEnv from sweagent.utils.config import convert_path_to_abspath, convert_paths_to_abspath -from sweagent.utils.log import get_logger from sweagent.utils.instrumentation import instrument +from sweagent.utils.log import get_logger logger = get_logger("agents") @@ -643,7 +643,12 @@ def forward_model(self, observation: str, state: str) -> ModelQueryResult: if is_init: # Show instance template if prev. obs. was initial system message self.made_initial_prompt = True - templates = [self.config.instance_template] + # NOTE: Uncomment this to force-feed manually constructed data into initial prompt. + # from sweagent.agent.manual_prompt_input import MANUAL_ANALYSIS_PROMPT + # templates = [ + # self.config.instance_template, + # self.config.next_step_template] + # observation = MANUAL_ANALYSIS_PROMPT if self.config.strategy_template is not None: templates.append(self.config.strategy_template) elif observation is None or observation.strip() == "": diff --git a/sweagent/environment/swe_env.py b/sweagent/environment/swe_env.py index 64d5270ef..fbb244806 100644 --- a/sweagent/environment/swe_env.py +++ b/sweagent/environment/swe_env.py @@ -488,9 +488,7 @@ def _container_patch_path(self): return "/root/test.patch" def _prepare_test_patch(self): - ln = "\n" patch = self.record["test_patch"] - self.logger.debug(f"Preparing patch at {self._container_patch_path}:{ln}{ln}{patch}") self.copy_string_to_container_file(patch, self._container_patch_path)