Skip to main content

Module code_mode

Module code_mode 

Source
Expand description

Code mode: a tool through which the model runs a short Python program whose functions are the session’s own tools, each call governed like a direct call. See Live::code_mode.

Structs§

CodeFunction
A function a program can call: a tool of the session, by name.
CodeLimits
Bounds on one program.
CodeMode
The code tool of a session: its name, the tools a program can call, its limits and the sandbox it runs in. See the module docs.
InProcess
Runs programs in Monty on a blocking thread of this process.
MontyPool
Runs programs in a pool of Monty worker processes.
Program
A program running in a sandbox, suspended at a call or finished. See CodeMode::start.
Unavailable
A sandbox that refuses every program: the default when this crate is built without the code-mode feature.

Enums§

Suspension
Where a program has stopped: at a call to one of its functions, or at its end.

Constants§

DEFAULT_TOOL
The default name of the code tool.

Traits§

CodeSandbox
Runs programs: Python source with the given functions defined as globals.
Execution
A program suspended at a call. Dropping it cancels the program.

Functions§

arguments
Name a call’s arguments for declaration: positional values in stub order, then the keywords. The errors are Python’s, for the program.
parameters
The parameters of declaration in stub order: required ones first, in the order the declaration requires them, then the optional ones.
python_stub
The Python stub for declaration: its signature and a docstring with the tool’s description, its parameters’ descriptions and, when known, what it returns.
without_redefinitions
source without its own stand-ins for the session’s functions.