{
"title": "functions.ScalarFunctionTaskExpression",
"description": "Expression for a task that calls a scalar function (pre-compilation).",
"type": "object",
"$ref": "RemotePath",
"properties": {
"input": {
"description": "Expression for the input to pass to the function.\nReceives: `input`, `map` (if mapped).\n\nA value that can be either a literal or an expression.\n\nThis allows Function definitions to mix static values with dynamic\nexpressions. During compilation, expressions are evaluated while\nliteral values pass through unchanged.\n\n# Example\n\nLiteral value:\n```json\n\"hello world\"\n```\n\nJMESPath expression:\n```json\n{\"$jmespath\": \"input.greeting\"}\n```\n\nStarlark expression:\n```json\n{\"$starlark\": \"input['greeting']\"}\n```",
"anyOf": [
{
"title": "Expression",
"description": "An expression (JMESPath or Starlark) to evaluate.",
"$ref": "functions.expression.Expression"
},
{
"title": "Value",
"description": "A literal value.",
"$ref": "functions.expression.InputValueExpression"
}
]
},
"map": {
"description": "Expression that evaluates to the number of mapped task instances.\nEach instance receives `map` as an integer index (0-based).",
"anyOf": [
{
"$ref": "functions.expression.Expression"
},
{
"type": "null"
}
],
"omitempty": true
},
"output": {
"description": "Expression to transform the task result into a valid function output.\n\nReceives `output` which is one of 4 variants:\n- `Scalar(Decimal)` - a single score\n- `Vector(Vec<Decimal>)` - a vector of scores\n- `Vectors(Vec<Vec<Decimal>>)` - multiple vectors (from mapped tasks)\n- `Err(Value)` - an error\n\nThe expression must return a `TaskOutputOwned` that is valid for the parent function's type:\n- For scalar functions: must return `Scalar(value)` where value is in [0, 1]\n- For vector functions: must return `Vector(values)` where values sum to ~1 and match the expected length\n\nThe function's final output is computed as a weighted average of all task outputs using\nprofile weights. If a function has only one task, that task's output becomes the function's\noutput directly.",
"$ref": "functions.expression.Expression"
},
"skip": {
"description": "If this expression evaluates to true, skip the task. Receives: `input`.",
"anyOf": [
{
"$ref": "functions.expression.Expression"
},
{
"type": "null"
}
],
"omitempty": true
}
}
}