pub struct ScalarFunctionTaskExpression {
pub path: RemotePath,
pub skip: Option<Expression>,
pub map: Option<Expression>,
pub input: WithExpression<InputValueExpression>,
pub output: Expression,
}Expand description
Expression for a task that calls a scalar function (pre-compilation).
Fields§
§path: RemotePath§skip: Option<Expression>If this expression evaluates to true, skip the task. Receives: input.
map: Option<Expression>Expression that evaluates to the number of mapped task instances.
Each instance receives map as an integer index (0-based).
input: WithExpression<InputValueExpression>Expression for the input to pass to the function.
Receives: input, map (if mapped).
output: ExpressionExpression to transform the task result into a valid function output.
Receives output which is one of 4 variants:
Scalar(Decimal)- a single scoreVector(Vec<Decimal>)- a vector of scoresVectors(Vec<Vec<Decimal>>)- multiple vectors (from mapped tasks)Err(Value)- an error
The expression must return a TaskOutputOwned that is valid for the parent function’s type:
- For scalar functions: must return
Scalar(value)where value is in [0, 1] - For vector functions: must return
Vector(values)where values sum to ~1 and match the expected length
The function’s final output is computed as a weighted average of all task outputs using profile weights. If a function has only one task, that task’s output becomes the function’s output directly.
Implementations§
Source§impl ScalarFunctionTaskExpression
impl ScalarFunctionTaskExpression
pub fn url(&self) -> String
Sourcepub fn compile(
self,
params: &Params<'_, '_>,
) -> Result<ScalarFunctionTask, ExpressionError>
pub fn compile( self, params: &Params<'_, '_>, ) -> Result<ScalarFunctionTask, ExpressionError>
Compiles the expression into a concrete ScalarFunctionTask.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for ScalarFunctionTaskExpression
impl<'arbitrary> Arbitrary<'arbitrary> for ScalarFunctionTaskExpression
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl Clone for ScalarFunctionTaskExpression
impl Clone for ScalarFunctionTaskExpression
Source§fn clone(&self) -> ScalarFunctionTaskExpression
fn clone(&self) -> ScalarFunctionTaskExpression
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScalarFunctionTaskExpression
impl Debug for ScalarFunctionTaskExpression
Source§impl<'de> Deserialize<'de> for ScalarFunctionTaskExpression
impl<'de> Deserialize<'de> for ScalarFunctionTaskExpression
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ScalarFunctionTaskExpression
impl JsonSchema for ScalarFunctionTaskExpression
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for ScalarFunctionTaskExpression
impl PartialEq for ScalarFunctionTaskExpression
Source§fn eq(&self, other: &ScalarFunctionTaskExpression) -> bool
fn eq(&self, other: &ScalarFunctionTaskExpression) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ScalarFunctionTaskExpression
Auto Trait Implementations§
impl Freeze for ScalarFunctionTaskExpression
impl RefUnwindSafe for ScalarFunctionTaskExpression
impl Send for ScalarFunctionTaskExpression
impl Sync for ScalarFunctionTaskExpression
impl Unpin for ScalarFunctionTaskExpression
impl UnsafeUnpin for ScalarFunctionTaskExpression
impl UnwindSafe for ScalarFunctionTaskExpression
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more