Skip to content

Commit

Permalink
fix: tool name conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
bboynton97 committed Oct 30, 2024
1 parent 0ddad90 commit fbf0398
Show file tree
Hide file tree
Showing 11 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions agentstack/generation/tool_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def add_tool(tool_name: str, path: Optional[str] = None):
with importlib.resources.path(f'agentstack.tools', f"{tool_name}.json") as tool_data_path:
tool_data = open_json_file(tool_data_path)

with importlib.resources.path(f'agentstack.templates.{framework}.tools', f"{tool_name}.py") as tool_file_path:
with importlib.resources.path(f'agentstack.templates.{framework}.tools', f"{tool_name}_tool.py") as tool_file_path:
os.system(tool_data['package']) # Install package
shutil.copy(tool_file_path, f'{path + "/" if path else ""}src/tools/{tool_name}.py') # Move tool from package to project
add_tool_to_tools_init(tool_data, path) # Export tool from tools dir
Expand All @@ -42,7 +42,7 @@ def add_tool_to_tools_init(tool_data: dict, path: Optional[str] = None):
file_path = f'{path + "/" if path else ""}src/tools/__init__.py'
tag = '# tool import'
code_to_insert = [
f"from {tool_data['name']} import {', '.join([tool_name for tool_name in tool_data['tools']])}"
f"from {tool_data['name']}_tool import {', '.join([tool_name for tool_name in tool_data['tools']])}"
]
insert_code_after_tag(file_path, tag, code_to_insert, next_line=True)

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions agentstack/tools/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@
"url": "https://github.com/OpenInterpreter/open-interpreter"
}],
"computer-control": [{
"name": "directory-search-tool",
"name": "directory_search",
"url": "https://github.com/crewAIInc/crewAI-tools/tree/main/crewai_tools/tools/directory_search_tool"
},{
"name": "file_read_tool",
"name": "file_read",
"url": "https://github.com/crewAIInc/crewAI-tools/tree/main/crewai_tools/tools/file_read_tool"
},{
"name": "ftp",
"url": "AgentStack custom tool"
}],
"network-protocols": [{
"name": "agent-connect",
"name": "agent_connect",
"url": "https://github.com/chgaowei/AgentConnect"
}]
}

0 comments on commit fbf0398

Please sign in to comment.