Skip to content

Commit

Permalink
Merge pull request emrgnt-cmplxty#54 from maks-ivanov/feature/version…
Browse files Browse the repository at this point in the history
…-to-config-rename

version -> config
  • Loading branch information
emrgnt-cmplxty authored Apr 24, 2023
2 parents e1cb5a0 + fe547d7 commit 7d0f8d6
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions automata/core/agents/automata_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ def with_instructions(self, instructions: str):
self._instance.instructions = instructions
return self

def with_version(self, version: AgentConfig):
self._instance.version = version
def with_config(self, config: AgentConfig):
self._instance.config = config
return self

def with_model(self, model: str):
Expand Down Expand Up @@ -106,7 +106,7 @@ def __init__(self):
initial_payload (Dict[str, str]): Initial payload to send to the agent.
llm_toolkits (Dict[ToolkitType, Toolkit]): A dictionary of toolkits to use.
instructions (str): A string of instructions to execute.
version (AgentConfig): The version of the agent to use.
config (AgentConfig): The config of the agent to use.
model (str): The model to use for the agent.
stream (bool): Whether to stream the results back to the master.
verbose (bool): Whether to print the results to stdout.
Expand All @@ -122,7 +122,7 @@ def __init__(self):
self.initial_payload = {}
self.llm_toolkits = {}
self.instructions = ""
self.version = AgentConfig.AUTOMATA_MASTER_V2
self.config = AgentConfig.AUTOMATA_MASTER_V2
self.model = "gpt-4"
self.stream = False
self.verbose = True
Expand Down Expand Up @@ -281,7 +281,7 @@ def extend_last_instructions(self, new_message: str) -> None:
def _load_prompt(self) -> str:
"""Load the prompt from a config specified at initialization."""
with open(
format_config_path("agent_configs", f"{self.version.value}.yaml"),
format_config_path("agent_configs", f"{self.config.value}.yaml"),
"r",
) as file:
loaded_yaml = yaml.safe_load(file)
Expand Down
4 changes: 2 additions & 2 deletions automata/core/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
def build_agent_with_params(
automata_params,
instructions: str,
version: AgentConfig = AgentConfig.AUTOMATA_RETRIEVER_V2,
config: AgentConfig = AgentConfig.AUTOMATA_RETRIEVER_V2,
max_iters=2,
temperature=0.0,
model="gpt-3.5-turbo",
Expand All @@ -30,7 +30,7 @@ def build_agent_with_params(
.with_llm_toolkits(mock_llm_toolkits)
.with_verbose(True)
.with_max_iters(max_iters)
.with_version(version)
.with_config(config)
.with_temperature(temperature)
.with_model(model)
.build()
Expand Down
4 changes: 2 additions & 2 deletions automata/core/tests/test_regression_core_t_equal_0p7.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_advanced_writer_example(automata_params):
agent = build_agent_with_params(
automata_params,
f"Write the following module - '{expected_content}' to the file core.tests.sample_code.test2",
version=AgentConfig.AUTOMATA_WRITER_V2,
config=AgentConfig.AUTOMATA_WRITER_V2,
max_iters=2,
temperature=TEMPERATURE,
model=MODEL,
Expand Down Expand Up @@ -125,7 +125,7 @@ def test_retrieve_run_and_write_out(automata_params):
automata_params,
f'1. Retrieve the raw code (code + docstrings) for the function "run" from the automata agent.\n'
f"2. NEXT, write the full raw code into the file core.tests.sample_code.test3",
version=AgentConfig.AUTOMATA_MASTER_V3,
config=AgentConfig.AUTOMATA_MASTER_V3,
max_iters=5,
)

Expand Down
4 changes: 2 additions & 2 deletions automata/scripts/docstring_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
def update_docstrings():
logging.config.dictConfig(get_logging_config())
parser = argparse.ArgumentParser(description="Run the AutomataAgent.")
parser.add_argument("--version", type=str, default="automata_docstring_manager_v1")
parser.add_argument("--config", type=str, default="automata_docstring_manager_v1")
parser.add_argument("--file_path", type=Optional[str], default=None)
args = parser.parse_args()
llm_toolkits = load_llm_toolkits(["python_indexer", "python_writer"])
Expand Down Expand Up @@ -51,7 +51,7 @@ def update_docstrings():
f" NOTE the key changes you have made. The code may be written dirrectly in your prompt and a developer will paste it into the file."
)
.with_llm_toolkits(llm_toolkits)
.with_version(AgentConfig(args.version))
.with_config(AgentConfig(args.config))
.with_model("gpt-4")
.with_stream(True)
.with_verbose(True)
Expand Down
6 changes: 3 additions & 3 deletions automata/scripts/main_automata.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ def main():
parser = argparse.ArgumentParser(description="Run the AutomataAgent.")
parser.add_argument("--instructions", type=str, help="The initial instructions for the agent.")
parser.add_argument(
"--version",
"--config",
type=AgentConfig,
default=AgentConfig.AUTOMATA_MASTER_V2,
help="The version of the agent.",
help="The config of the agent.",
)
parser.add_argument(
"--model", type=str, default="gpt-4", help="The model to be used for the agent."
Expand Down Expand Up @@ -69,7 +69,7 @@ def main():
.with_initial_payload(initial_payload)
.with_instructions(args.instructions)
.with_llm_toolkits(llm_toolkits)
.with_version(args.version)
.with_config(args.config)
.with_model(args.model)
.with_session_id(args.session_id)
.with_stream(args.stream)
Expand Down
2 changes: 1 addition & 1 deletion automata/tools/python_tools/tests/test_python_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def test_reduce_module_remove_function(python_writer):
def test_update_existing_function(python_writer):
mock_generator = MockCodeGenerator(has_function=True)
source_code = mock_generator.generate_code()
# Create a new version of the function with a different body
# Create a new config of the function with a different body
source_code_updated = textwrap.dedent(
f"""
def {mock_generator.function_name}():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def _run_automata_indexer_retrieve_code(self, path_str: str) -> str:
.with_initial_payload(initial_payload)
.with_instructions(instructions)
.with_llm_toolkits(load_llm_toolkits(["python_indexer"]))
.with_version(self.automata_version)
.with_config(self.automata_version)
.with_model(self.model)
.with_stream(self.stream)
.with_verbose(self.verbose)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def _automata_update_module(self, input_str: str) -> str:
.with_initial_payload(initial_payload)
.with_instructions(input_str)
.with_llm_toolkits(load_llm_toolkits(["python_writer"]))
.with_version(self.automata_version)
.with_config(self.automata_version)
.with_model(self.model)
.with_stream(self.stream)
.with_verbose(self.verbose)
Expand Down

0 comments on commit 7d0f8d6

Please sign in to comment.