su3su2u1 commited on
Commit
d46d77c
·
unverified ·
1 Parent(s): a691d55
Files changed (1) hide show
  1. theagent.py +5 -4
theagent.py CHANGED
@@ -39,24 +39,25 @@ cache = {
39
  }
40
 
41
 
42
- class ExecutePythonTool(PythonInterpreterTool):
43
  name = "python_executor"
44
  description = "This is a tool that executes a python file."
45
  output_type = "string"
46
 
47
  def __init__(self, *args, authorized_imports=None, **kwargs):
48
- super().__init__(*args, **kwargs)
49
  self.inputs = {
50
  "file_path": {
51
  "type": "string",
52
- "description": "The python file path to run in interpreter",
53
  }
54
  }
 
55
 
56
  def forward(self, file_path: str) -> str:
57
  with open(file_path) as f:
58
  code = f.read()
59
- return super().forward(code)
60
 
61
 
62
  class BasicAgent:
 
39
  }
40
 
41
 
42
+ class ExecutePythonTool(Tool):
43
  name = "python_executor"
44
  description = "This is a tool that executes a python file."
45
  output_type = "string"
46
 
47
  def __init__(self, *args, authorized_imports=None, **kwargs):
48
+ self.python_interpreter = PythonInterpreterTool()
49
  self.inputs = {
50
  "file_path": {
51
  "type": "string",
52
+ "description": "The python file path to be executed",
53
  }
54
  }
55
+ super().__init__(*args, **kwargs)
56
 
57
  def forward(self, file_path: str) -> str:
58
  with open(file_path) as f:
59
  code = f.read()
60
+ return self.python_interpreter.forward(code)
61
 
62
 
63
  class BasicAgent: