Every method of client.model in the Python SDK.
check#
Check an ONNX model's folder · tool model_check
Nothing is started.
Declaration
client.model
def check(self, file: str) -> Dict[str, Any]Parameters
| Name | Type | What it is | |
|---|---|---|---|
file | str | required | An ONNX model's folder in the models folder. |
Returns
Dict[str, Any] — the tool’s answer as a dict of plain values.
What it answers
What the tool's description says.
Example
client.model.check("…")forget#
Forget a model an agent installed · tool model_forget
Removes a model an agent installed from the models folder - its files and its record. A model the person put there is the person's own to delete, and is refused here.
Declaration
client.model
def forget(self, name: str) -> Dict[str, Any]Parameters
| Name | Type | What it is | |
|---|---|---|---|
name | str | required | A model's name in the models folder. |
Returns
Dict[str, Any] — the tool’s answer as a dict of plain values.
What it answers
What the tool's description says.
Example
client.model.forget("…")infer#
Run a policy once · tool model_infer
Runs an ONNX model of the models folder on one input - the Gym's policy run by Bentrix (engine "bentrix") instead of the program's own runtime - consent checked, on the engine the person chose and in its host, the host kept for the next call. Answers its output values and how long it took.
Declaration
client.model
def infer(self, name: str, input: List[float]) -> Dict[str, Any]Parameters
| Name | Type | What it is | |
|---|---|---|---|
name | str | required | An ONNX policy's folder in the models folder: model.onnx, no manifest needed. |
input | List[float] | required | The flattened observation: the model's one input, [1, n] of 32-bit floats. |
Returns
Dict[str, Any] — the tool’s answer as a dict of plain values.
What it answers
Answers its output values and how long it took.
Example
client.model.infer("…", "…")info#
One model in the models folder · tool model_info
Declaration
client.model
def info(self, name: str) -> Dict[str, Any]Parameters
| Name | Type | What it is | |
|---|---|---|---|
name | str | required | A model's name in the models folder. |
Returns
Dict[str, Any] — the tool’s answer as a dict of plain values.
What it answers
What the tool's description says.
Example
client.model.info("…")install#
Install a model into the models folder · tool model_install
Writes a model into the person's models folder - an ONNX model (onnx_base64 with its manifest) or a Python model (python, its source) - where it waits for the person's tick on these exact bytes (Settings > Forecast > Models, Run it) before anything runs it; a model replaced since it was ticked waits again. A name the person's own file holds is never overwritten. Answers the model as model_list does, its consent waiting_for_the_tick.
Declaration
client.model
def install(self, name: str, *, manifest: Optional[Any] = None, onnx_base64: Optional[str] = None, python: Optional[str] = None) -> Dict[str, Any]Parameters
| Name | Type | What it is | |
|---|---|---|---|
name | str | required | The model's name in the models folder: a folder for an ONNX model, a.py name for a Python one. |
manifest | Optional[Any] | optional | Its manifest (model_manifest), with the ONNX file. |
onnx_base64 | Optional[str] | optional | An ONNX model's file, base64. |
python | Optional[str] | optional | A Python model's source, declaring one @bentrix.model. |
Returns
Dict[str, Any] — the tool’s answer as a dict of plain values.
What it answers
Answers the model as model_list does, its consent waiting_for_the_tick.
Example
client.model.install("…")list#
The models in the models folder · tool model_list
Every model in the person's models folder: its name, kind (onnx or python), the label its forecasts carry where the manifest says it, its hash, its consent (own - the person's file, no tick needed; waiting_for_the_tick - installed by an agent; ticked), the engine it would run on, and the ids it runs under now. Never where an engine's library is.
Declaration
client.model
def list(self) -> Dict[str, Any]It takes no arguments.
Returns
Dict[str, Any] — the tool’s answer as a dict of plain values.
What it answers
What the tool's description says.
Example
client.model.list()pause#
Pause or resume a model · tool model_pause
Pauses a running model (it is asked nothing at the closes while paused; its last forecast stays) or resumes it (paused false), as the legend row's Pause does. Answers its state.
Declaration
client.model
def pause(self, model: int, *, paused: Optional[bool] = None) -> Dict[str, Any]Parameters
| Name | Type | What it is | |
|---|---|---|---|
model | int | required | |
paused | Optional[bool] | optional | For model_pause: true pauses, false resumes. |
Returns
Dict[str, Any] — the tool’s answer as a dict of plain values.
What it answers
Answers its state.
Example
client.model.pause(1)run_once#
Run a model once at a close · tool model_run_once
Runs a model of the models folder once - consent checked, on the engine the person chose, in a process of its own unless the person keeps the built-in engine inside Bentrix - on the window cut at the last close of its interval at or before at_ms (the workbench's clock when omitted), and puts what it answers as its forecast - or, for a model whose manifest declares outputs (schema 2), each output as output_put puts it - authored model:<name>, stamped with the workbench's clock when it lands. The frame waits for it at most the Time cap per run. Answers the forecast's state (or the outputs put), the anchor, how long the model took and whether that was late.
Declaration
client.model
def run_once(self, name: str, bench: str, symbol: str, *, at_ms: Optional[int] = None) -> Dict[str, Any]Parameters
| Name | Type | What it is | |
|---|---|---|---|
name | str | required | A model's name in the models folder. |
bench | str | required | |
symbol | str | required | The market it forecasts, one of the workbench's. |
at_ms | Optional[int] | optional | A moment at or before the workbench's clock: the model runs at the last close of its interval by then. Omitted, the clock. |
Returns
Dict[str, Any] — the tool’s answer as a dict of plain values.
What it answers
Answers the forecast's state (or the outputs put), the anchor, how long the model took and whether that was late.
Example
client.model.run_once("…", bench, "SYN-DOCS")start#
Run a model file on a workbench · tool model_start
Starts a model from the person's models folder - a Python file declaring one @bentrix.model, run by the person's own interpreter, or an ONNX model's folder (model_manifest), run by Bentrix's built-in engine - in a process of its own, on a workbench's market: at each close of its interval it is handed the window cut there, and what it answers is put on the chart as its forecast, stamped with the instant it came back (a slow model's forecast arrives late, as a live program's does). Only a file in the models folder starts; its process carries no Bentrix variable. Answers the model's id and state.
Declaration
client.model
def start(self, bench: str, symbol: str, file: str) -> Dict[str, Any]Parameters
| Name | Type | What it is | |
|---|---|---|---|
bench | str | required | The workbench whose closes the model runs at. |
symbol | str | required | The market it forecasts, one of the workbench's. |
file | str | required | A name in the models folder: a.py declaring one @bentrix.model, or an ONNX model's folder (model.onnx beside its manifest.json, model_manifest). |
Returns
Dict[str, Any] — the tool’s answer as a dict of plain values.
What it answers
Answers the model's id and state.
Example
client.model.start(bench, "SYN-DOCS", "…")stop#
Stop a model · tool model_stop
Ends a model's process; its forecasts already put stay on the workbench until cleared.
Declaration
client.model
def stop(self, model: int, *, paused: Optional[bool] = None) -> Dict[str, Any]Parameters
| Name | Type | What it is | |
|---|---|---|---|
model | int | required | |
paused | Optional[bool] | optional | For model_pause: true pauses, false resumes. |
Returns
Dict[str, Any] — the tool’s answer as a dict of plain values.
What it answers
What the tool's description says.
Example
client.model.stop(1)