Bentrix Docs
HomePricingDashboard

Rust: model

Every method of client.model() in the Rust SDK.

check#

Check an ONNX model's folder · tool model_check

scope: readplan: freesince 3.4.0

Nothing is started.

Declaration

client.model()
pub fn check(&self, args: ModelCheckArgs) -> Result<Value

Parameters

NameTypeWhat it is
fileimpl Into<String>requiredAn ONNX model's folder in the models folder.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

What the tool's description says.

Example

client.model().check(mcp::ModelCheckArgs::new("…"))?

forget#

Forget a model an agent installed · tool model_forget

scope: adminplan: freesince 3.6.0

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()
pub fn forget(&self, args: ModelForgetArgs) -> Result<Value

Parameters

NameTypeWhat it is
nameimpl Into<String>requiredA model's name in the models folder.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

What the tool's description says.

Example

client.model().forget(mcp::ModelForgetArgs::new("…"))?

infer#

Run a policy once · tool model_infer

scope: labplan: freesince 3.6.0

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()
pub fn infer(&self, args: ModelInferArgs) -> Result<Value

Parameters

NameTypeWhat it is
nameimpl Into<String>requiredAn ONNX policy's folder in the models folder: model.onnx, no manifest needed.
inputVec<f64>requiredThe flattened observation: the model's one input, [1, n] of 32-bit floats.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers its output values and how long it took.

Example

client.model().infer(mcp::ModelInferArgs::new("…", "…"))?

info#

One model in the models folder · tool model_info

scope: readplan: freesince 3.6.0

Declaration

client.model()
pub fn info(&self, args: ModelInfoArgs) -> Result<Value

Parameters

NameTypeWhat it is
nameimpl Into<String>requiredA model's name in the models folder.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

What the tool's description says.

Example

client.model().info(mcp::ModelInfoArgs::new("…"))?

install#

Install a model into the models folder · tool model_install

scope: adminplan: freesince 3.6.0

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()
pub fn install(&self, args: ModelInstallArgs) -> Result<Value

Parameters

NameTypeWhat it is
nameimpl Into<String>requiredThe model's name in the models folder: a folder for an ONNX model, a.py name for a Python one.
manifestimpl Into<Value>optionalIts manifest (model_manifest), with the ONNX file.
onnx_base64impl Into<String>optionalAn ONNX model's file, base64.
pythonimpl Into<String>optionalA Python model's source, declaring one @bentrix.model.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the model as model_list does, its consent waiting_for_the_tick.

Example

client.model().install(mcp::ModelInstallArgs::new("…"))?

list#

The models in the models folder · tool model_list

scope: readplan: freesince 3.6.0

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()
pub fn list(&self) -> Result<Value

It takes no arguments.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

What the tool's description says.

Example

client.model().list()?

pause#

Pause or resume a model · tool model_pause

scope: labplan: freesince 3.4.0

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()
pub fn pause(&self, args: ModelPauseArgs) -> Result<Value

Parameters

NameTypeWhat it is
modeli64required
pausedbooloptionalFor model_pause: true pauses, false resumes.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers its state.

Example

client.model().pause(mcp::ModelPauseArgs::new(1))?

run_once#

Run a model once at a close · tool model_run_once

scope: labplan: freesince 3.6.0

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()
pub fn run_once(&self, args: ModelRunOnceArgs) -> Result<Value

Parameters

NameTypeWhat it is
nameimpl Into<String>requiredA model's name in the models folder.
benchimpl Into<String>required
symbolimpl Into<String>requiredThe market it forecasts, one of the workbench's.
at_msi64optionalA moment at or before the workbench's clock: the model runs at the last close of its interval by then. Omitted, the clock.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

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(mcp::ModelRunOnceArgs::new("…", bench.clone(), "SYN-DOCS"))?

start#

Run a model file on a workbench · tool model_start

scope: labplan: freesince 3.4.0

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()
pub fn start(&self, args: ModelStartArgs) -> Result<Value

Parameters

NameTypeWhat it is
benchimpl Into<String>requiredThe workbench whose closes the model runs at.
symbolimpl Into<String>requiredThe market it forecasts, one of the workbench's.
fileimpl Into<String>requiredA 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

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

Answers the model's id and state.

Example

client.model().start(mcp::ModelStartArgs::new(bench.clone(), "SYN-DOCS", "…"))?

stop#

Stop a model · tool model_stop

scope: labplan: freesince 3.4.0

Ends a model's process; its forecasts already put stay on the workbench until cleared.

Declaration

client.model()
pub fn stop(&self, args: ModelStopArgs) -> Result<Value

Parameters

NameTypeWhat it is
modeli64required
pausedbooloptionalFor model_pause: true pauses, false resumes.

Returns

Result<Value, Error> — the tool’s answer as a serde_json::Value.

What it answers

What the tool's description says.

Example

client.model().stop(mcp::ModelStopArgs::new(1))?

Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed