From fe547d799ac674566e9a7ebf3fb13f1bfd15724b Mon Sep 17 00:00:00 2001 From: Owen Colegrove Date: Sun, 23 Apr 2023 22:37:27 -0400 Subject: [PATCH] version -> config --- automata/core/agents/automata_agent.py | 10 +++++----- automata/core/tests/conftest.py | 4 ++-- .../core/tests/test_regression_core_t_equal_0p7.py | 4 ++-- automata/scripts/docstring_cleanup.py | 4 ++-- automata/scripts/main_automata.py | 6 +++--- .../tools/python_tools/tests/test_python_writer.py | 2 +- .../tool_management/python_indexer_tool_manager.py | 2 +- .../tool_management/python_writer_tool_manager.py | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/automata/core/agents/automata_agent.py b/automata/core/agents/automata_agent.py index 0e75dc98..0bb0b3b7 100644 --- a/automata/core/agents/automata_agent.py +++ b/automata/core/agents/automata_agent.py @@ -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): @@ -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. @@ -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 @@ -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) diff --git a/automata/core/tests/conftest.py b/automata/core/tests/conftest.py index 500eac45..c4c493f1 100644 --- a/automata/core/tests/conftest.py +++ b/automata/core/tests/conftest.py @@ -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", @@ -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() diff --git a/automata/core/tests/test_regression_core_t_equal_0p7.py b/automata/core/tests/test_regression_core_t_equal_0p7.py index bd48e645..67bd0608 100644 --- a/automata/core/tests/test_regression_core_t_equal_0p7.py +++ b/automata/core/tests/test_regression_core_t_equal_0p7.py @@ -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, @@ -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, ) diff --git a/automata/scripts/docstring_cleanup.py b/automata/scripts/docstring_cleanup.py index 418bd40f..d617c320 100644 --- a/automata/scripts/docstring_cleanup.py +++ b/automata/scripts/docstring_cleanup.py @@ -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"]) @@ -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) diff --git a/automata/scripts/main_automata.py b/automata/scripts/main_automata.py index b7865b78..0f3bbff4 100644 --- a/automata/scripts/main_automata.py +++ b/automata/scripts/main_automata.py @@ -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." @@ -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) diff --git a/automata/tools/python_tools/tests/test_python_writer.py b/automata/tools/python_tools/tests/test_python_writer.py index a5c00bbd..b676cd44 100644 --- a/automata/tools/python_tools/tests/test_python_writer.py +++ b/automata/tools/python_tools/tests/test_python_writer.py @@ -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}(): diff --git a/automata/tools/tool_management/python_indexer_tool_manager.py b/automata/tools/tool_management/python_indexer_tool_manager.py index 7dc32694..0d189073 100644 --- a/automata/tools/tool_management/python_indexer_tool_manager.py +++ b/automata/tools/tool_management/python_indexer_tool_manager.py @@ -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) diff --git a/automata/tools/tool_management/python_writer_tool_manager.py b/automata/tools/tool_management/python_writer_tool_manager.py index de0b721d..0f5481fa 100644 --- a/automata/tools/tool_management/python_writer_tool_manager.py +++ b/automata/tools/tool_management/python_writer_tool_manager.py @@ -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)