Skip to main content

compileFunctionOutput

Function compileFunctionOutput 

Source
pub fn compileFunctionOutput(
    function: JsValue,
    input: JsValue,
    task_outputs: JsValue,
) -> Result<JsValue, JsValue>
Expand description

Computes the final output of a Function given input and task results.

Evaluates the function’s output expression using the provided input data and task outputs. Also validates that the output meets constraints:

  • Scalar functions: output must be in [0, 1]
  • Vector functions: output must sum to approximately 1

§Arguments

  • function - JavaScript object representing a Function definition
  • input - JavaScript object representing the function input
  • task_outputs - Array of task outputs (from actual execution or mocked)

§Returns

An object with:

  • output: The computed scalar or vector output
  • valid: Boolean indicating if the output meets constraints

§Errors

Returns an error string if expression evaluation fails.