aiq.tool.code_execution.code_sandbox#
Attributes#
Classes#
Code execution sandbox. |
|
Locally hosted sandbox. |
|
Piston sandbox (engineer-man/piston) |
Functions#
|
A helper function to make it easier to set sandbox through cmd. |
Module Contents#
- logger#
- class Sandbox(*, uri: pydantic.HttpUrl)#
Bases:
abc.ABC
Code execution sandbox.
- Args:
- host: Optional[str] = ‘127.0.0.1’ - Host of the sandbox server.
Can also be specified through NEMO_SKILLS_SANDBOX_HOST env var.
- port: Optional[str] = ‘5000’ - Port of the sandbox server.
Can also be specified through NEMO_SKILLS_SANDBOX_PORT env var.
- ssh_server: Optional[str] = None - SSH server for tunneling requests.
Useful if server is running on slurm cluster to which there is an ssh access. Can also be specified through NEMO_SKILLS_SSH_SERVER env var.
- ssh_key_path: Optional[str] = None - Path to the ssh key for tunneling.
Can also be specified through NEMO_SKILLS_SSH_KEY_PATH env var.
- url#
- http_session#
- _send_request(request, timeout)#
- abstractmethod _parse_request_output(output)#
- abstractmethod _get_execute_url(uri)#
- abstractmethod _prepare_request(generated_code, timeout)#
- class LocalSandbox(*, uri: pydantic.HttpUrl)#
Bases:
Sandbox
Locally hosted sandbox.
- _get_execute_url(uri)#
- _parse_request_output(output)#
- _prepare_request(generated_code, timeout, language='python', **kwargs)#
- class PistonSandbox(*, uri: pydantic.HttpUrl)#
Bases:
Sandbox
Piston sandbox (engineer-man/piston)
- _get_execute_url(uri)#
- _parse_request_output(output)#
- sandboxes#