Skip to main content

BaseInterpreter

class BaseInterpreter(ABC):
An abstract base class for code interpreters.

run

def run(self, code: str, code_type: str):
Executes the given code based on its type. Parameters:
  • code (str): The code to be executed.
  • code_type (str): The type of the code, which must be one of the types returned by supported_code_types().
Returns: str: The result of the code execution. If the execution fails, this should include sufficient information to diagnose and correct the issue.

supported_code_types

def supported_code_types(self):
Provides supported code types by the interpreter.

update_action_space

def update_action_space(self, action_space: Dict[str, Any]):
Updates action space for python interpreter

execute_command

def execute_command(self, command: str):
Executes a command in the interpreter. Parameters:
  • command (str): The command to execute.
Returns: Tuple[str, str]: A tuple containing the stdout and stderr of the command execution.