Interface: ModelRunner

April 26, 2025 ยท View on GitHub

@sdeverywhere/runtime / ModelRunner

Interface: ModelRunner

Abstraction that allows for running a generated model on the JS thread or asynchronously (e.g. in a Web Worker), depending on the implementation.

Methods

createOutputs

createOutputs(): Outputs

Create an Outputs instance that is sized to accommodate the output variable data stored by the model.

Returns

Outputs

A new Outputs instance.


runModel

runModel(inputs, outputs, options?): Promise<Outputs>

Run the model.

Parameters

NameTypeDescription
inputsnumber[] | InputValue[]The model input values (must be in the same order as in the spec file).
outputsOutputsThe structure into which the model outputs will be stored.
options?RunModelOptionsAdditional options that influence the model run.

Returns

Promise<Outputs>

A promise that resolves with the outputs when the model run is complete.


terminate

terminate(): Promise<void>

Terminate the runner by releasing underlying resources (e.g., the worker thread or Wasm module/buffers).

Returns

Promise<void>