Skip to content

Commit

Permalink
Adjusted default tool template
Browse files Browse the repository at this point in the history
  • Loading branch information
VRSEN committed Mar 4, 2024
1 parent b7bee78 commit a0d05da
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions agency_swarm/util/create_agent_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,32 @@ def __init__(self):

example_tool_template = """from agency_swarm.tools import BaseTool
from pydantic import Field
import os
account_id = "MY_ACCOUNT_ID"
api_key = os.getenv("MY_API_KEY") # or access_token = os.getenv("MY_ACCESS_TOKEN")
class MyCustomTool(BaseTool):
\"\"\"
A brief description of what the custom tool does.
The docstring should clearly explain the tool's purpose and functionality.
It will be used by the agent to determine when to use this tool.
\"\"\"
class ExampleTool(BaseTool):
\"\"\"Enter your tool description here. It should be informative for the Agent.\"\"\"
content: str = Field(
..., description="Enter parameter descriptions using pydantic for the model here."
# Define the fields with descriptions using Pydantic Field
example_field: str = Field(
..., description="Description of the example field, explaining its purpose and usage for the Agent."
)
def run(self):
# Enter your tool code here. It should return a string.
# do_something(self.content)
return "Tool output"
\"\"\"
The implementation of the run method, where the tool's main functionality is executed.
This method should utilize the fields defined above to perform the task.
Docstring is not required for this method and will not be used by the agent.
\"\"\"
# Your custom tool logic goes here
# do_something(self.example_field, api_key, account_id)
# Return the result of the tool's operation as a string
return "Result of MyCustomTool operation"
"""

0 comments on commit a0d05da

Please sign in to comment.