From 26c9ce132be3311a8a5f97659cc726dfbf4802cd Mon Sep 17 00:00:00 2001 From: Aravind Somaraj <104314434+aravindsomaraj@users.noreply.github.com> Date: Mon, 1 Apr 2024 20:17:58 +0530 Subject: [PATCH] style: Moved argument parsing statements into a separate function (#503) * style: moved argument parsing into a separate function * commito * Update evaluation/regression/conftest.py --------- Co-authored-by: Robert Brennan --- evaluation/regression/conftest.py | 1 - opendevin/main.py | 10 +++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/evaluation/regression/conftest.py b/evaluation/regression/conftest.py index fb9b0adaf9..34971a915a 100644 --- a/evaluation/regression/conftest.py +++ b/evaluation/regression/conftest.py @@ -59,7 +59,6 @@ def workspace_dir(test_cases_dir, request): test_case_dir = os.path.dirname(request.module.__file__) workspace_dir = os.path.join(test_case_dir, 'workspace') return workspace_dir - @pytest.fixture def model(request): """Fixture that provides the model name. diff --git a/opendevin/main.py b/opendevin/main.py index 1295f554b5..8285456c65 100644 --- a/opendevin/main.py +++ b/opendevin/main.py @@ -18,8 +18,8 @@ def read_task_from_stdin() -> str: """Read task from stdin.""" return sys.stdin.read() -async def main(): - """Main coroutine to run the agent controller with task input flexibility.""" +def parse_arguments(): + """Parse command-line arguments.""" parser = argparse.ArgumentParser(description="Run an agent with a specific task") parser.add_argument("-d", "--directory", required=True, type=str, help="The working directory for the agent") parser.add_argument("-t", "--task", type=str, default="", help="The task for the agent to perform") @@ -27,7 +27,11 @@ async def main(): parser.add_argument("-c", "--agent-cls", default="LangchainsAgent", type=str, help="The agent class to use") parser.add_argument("-m", "--model-name", default=config.get_or_default("LLM_MODEL", "gpt-4-0125-preview"), type=str, help="The (litellm) model name to use") parser.add_argument("-i", "--max-iterations", default=100, type=int, help="The maximum number of iterations to run the agent") - args = parser.parse_args() + return parser.parse_args() + +async def main(): + """Main coroutine to run the agent controller with task input flexibility.""" + args = parse_arguments() # Determine the task source if args.file: