From 66dfa22ac10e23a38aa46844627cbdff75f99fe6 Mon Sep 17 00:00:00 2001 From: Arsenii Shatokhin Date: Tue, 6 Feb 2024 10:46:32 +0400 Subject: [PATCH] Added param for example tools in create_agent_template.py --- .../AgentCreator/tools/CreateAgentTemplate.py | 3 ++- agency_swarm/util/create_agent_template.py | 17 +++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/agency_swarm/agency/genesis/AgentCreator/tools/CreateAgentTemplate.py b/agency_swarm/agency/genesis/AgentCreator/tools/CreateAgentTemplate.py index a81f93dd..2617a07c 100644 --- a/agency_swarm/agency/genesis/AgentCreator/tools/CreateAgentTemplate.py +++ b/agency_swarm/agency/genesis/AgentCreator/tools/CreateAgentTemplate.py @@ -40,7 +40,8 @@ def run(self): create_agent_template(self.agent_name, self.agent_description, instructions=self.instructions, - code_interpreter=True if "CodeInterpreter" in self.default_tools else None) + code_interpreter=True if "CodeInterpreter" in self.default_tools else None, + include_example_tool=False) # add agent on second line to agency.py with open("agency.py", "r") as f: diff --git a/agency_swarm/util/create_agent_template.py b/agency_swarm/util/create_agent_template.py index b55f6510..b0eac8f4 100644 --- a/agency_swarm/util/create_agent_template.py +++ b/agency_swarm/util/create_agent_template.py @@ -6,7 +6,8 @@ def create_agent_template(agent_name=None, path="./", instructions=None, code_interpreter=False, - use_txt=False): + use_txt=False, + include_example_tool=True): if not agent_name: agent_name = input("Enter agent name: ") if not agent_description: @@ -17,10 +18,10 @@ def create_agent_template(agent_name=None, if not os.path.isfile(os.path.join(path, agency_manifesto)): with open(os.path.join(path, agency_manifesto), "w") as f: f.write("As a member of our Agency, please find below the guiding principles and values that constitute " - "our Agency Manifesto:\n\n")\ - + "our Agency Manifesto:\n\n") \ + \ class_name = agent_name.replace(" ", "").strip() - folder_name = agent_name # .lower().replace(" ", "_").strip() + folder_name = agent_name # .lower().replace(" ", "_").strip() # create or append to init file global_init_path = os.path.join(path, "__init__.py") @@ -65,13 +66,13 @@ def create_agent_template(agent_name=None, os.mkdir(path + "schemas") os.mkdir(path + "tools") - # create tools file - with open(path + "tools/" + "ExampleTool.py", "w") as f: - f.write(example_tool_template) - with open(path + "tools/" + "__init__.py", "w") as f: f.write("") + if include_example_tool: + with open(path + "tools/" + "ExampleTool.py", "w") as f: + f.write(example_tool_template) + print("Agent folder created successfully.") print(f"Import it with: from {folder_name} import {class_name}")