Skip to content

Commit

Permalink
Improve --help message option headers (#192)
Browse files Browse the repository at this point in the history
The docstrings of the argument dataclasses are also used in the --help
message. If they aren't set, the signature of the dataclass is shown
instead.
  • Loading branch information
klieret committed Apr 11, 2024
1 parent b084c9f commit 388d79f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __post_init__(self):

@dataclass(frozen=True)
class ScriptArguments(FlattenedAccess, FrozenSerializable):
"""Configure the control flow of the run.py script"""
environment: EnvironmentArguments
agent: AgentArguments
actions: ActionsArguments
Expand Down
1 change: 1 addition & 0 deletions sweagent/agent/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def __post_init__(self):

@dataclass(frozen=True)
class AgentArguments(FlattenedAccess, FrozenSerializable):
"""Configure the agent's behaviour (templates, parse functions, blocklists, ...)."""
model: ModelArguments = None

# Policy can only be set via config yaml file from command line
Expand Down
1 change: 0 additions & 1 deletion sweagent/agent/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ def generate_command_docs(self, commands: List[Command], subroutine_types, **kwa

class ParseCommandBash(ParseCommand):
def parse_command_file(self, path: str) -> List[Command]:
print('Parsing command file:', path)
contents = open(path, "r").read()
if contents.strip().startswith("#!"):
commands = self.parse_script(path, contents)
Expand Down
1 change: 1 addition & 0 deletions sweagent/agent/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

@dataclass(frozen=True)
class ModelArguments(FrozenSerializable):
"""Arguments configuring the model and its behavior."""
model_name: str
per_instance_cost_limit: float = 0.0
total_cost_limit: float = 0.0
Expand Down
2 changes: 2 additions & 0 deletions sweagent/environment/swe_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@

@dataclass(frozen=True)
class EnvironmentArguments(FrozenSerializable):
"""Configure data sources and setup instructions for th environment in which we solve the tasks.
"""
data_path: str
image_name: str
split: str = "dev"
Expand Down

0 comments on commit 388d79f

Please sign in to comment.