Skip to content

Commit

Permalink
Removed Terminal tool as it was unused
Browse files Browse the repository at this point in the history
  • Loading branch information
antoninoLorenzo committed Aug 9, 2024
1 parent dfb1a2d commit 559f58d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from src.agent.memory import Memory, Message, Role
from src.agent.plan import Plan, Task
from src.agent.prompts import PROMPTS
from src.agent.tools import Terminal
from src.agent.tools import Tool


class Agent:
Expand Down Expand Up @@ -192,7 +192,7 @@ def extract_plan(self, plan_nl):
tasks.append(Task(
command=cmd,
thought=task['thought'] if 'thought' in task else None,
tool=Terminal
tool=Tool
))

return Plan(tasks)
Expand Down
3 changes: 1 addition & 2 deletions src/agent/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@
from pathlib import Path

from src.agent.tools.base import Tool
from src.agent.tools.terminal import Terminal

TOOLS_PATH = Path(Path.home() / '.aiops' / 'tools')
if not TOOLS_PATH.exists():
TOOLS_PATH.mkdir(parents=True, exist_ok=True)

TOOLS = [Terminal()]
TOOLS = []
for path in TOOLS_PATH.iterdir():
tool = Tool.load_tool(str(path))
TOOLS.append(tool)
15 changes: 9 additions & 6 deletions src/agent/tools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ class Tool:
tool_description: str
args_description: str

def __init__(self, name: str, tool_description: str, args_description: str):
self.name = name
self.tool_description = tool_description
self.args_description = args_description

@staticmethod
def load_tool(path: str):
"""Get tool description from json file"""
with open(path, 'r', encoding='utf-8') as fp:
tool_data = json.load(fp)
name = tool_data['name']
tool_description = ''.join(tool_data['tool_description'])
args_description = ''.join(tool_data['args_description'])

tool = Tool()
tool.name = tool_data['name']
tool.tool_description = ''.join(tool_data['tool_description'])
tool.args_description = ''.join(tool_data['args_description'])

return tool
return Tool(name, tool_description, args_description)

@staticmethod
def run(*args):
Expand Down
28 changes: 0 additions & 28 deletions src/agent/tools/terminal.py

This file was deleted.

0 comments on commit 559f58d

Please sign in to comment.