Skip to content

Commit

Permalink
style: Moved argument parsing statements into a separate function (Al…
Browse files Browse the repository at this point in the history
…l-Hands-AI#503)

* style: moved argument parsing into a separate function

* commito

* Update evaluation/regression/conftest.py

---------

Co-authored-by: Robert Brennan <accounts@rbren.io>
  • Loading branch information
aravindsomaraj and rbren committed Apr 1, 2024
1 parent 64281c4 commit 26c9ce1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 0 additions & 1 deletion evaluation/regression/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 7 additions & 3 deletions opendevin/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,20 @@ 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")
parser.add_argument("-f", "--file", type=str, help="Path to a file containing the task. Overrides -t if both are provided.")
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:
Expand Down

0 comments on commit 26c9ce1

Please sign in to comment.