Skip to content

Commit

Permalink
Added param for example tools in create_agent_template.py
Browse files Browse the repository at this point in the history
  • Loading branch information
VRSEN committed Feb 6, 2024
1 parent c572417 commit 66dfa22
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
17 changes: 9 additions & 8 deletions agency_swarm/util/create_agent_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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")
Expand Down Expand Up @@ -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}")

Expand Down

0 comments on commit 66dfa22

Please sign in to comment.