pub struct VectorCompletionTaskExpression {
pub skip: Option<Expression>,
pub map: Option<Expression>,
pub messages: WithExpression<Vec<WithExpression<MessageExpression>>>,
pub responses: WithExpression<Vec<WithExpression<RichContentExpression>>>,
pub output: Expression,
}Expand description
Expression for a task that runs a vector completion (pre-compilation).
Fields§
§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).
messages: WithExpression<Vec<WithExpression<MessageExpression>>>Expression for the conversation messages (the prompt).
Receives: input, map (if mapped).
responses: WithExpression<Vec<WithExpression<RichContentExpression>>>Expression for the possible responses the LLMs can vote for.
Receives: input, map (if mapped).
output: ExpressionExpression to transform the task result into a valid function output.
Receives output as the task’s raw result (typically Vector(scores)).
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 VectorCompletionTaskExpression
impl VectorCompletionTaskExpression
Sourcepub fn compile(
self,
params: &Params<'_, '_>,
) -> Result<VectorCompletionTask, ExpressionError>
pub fn compile( self, params: &Params<'_, '_>, ) -> Result<VectorCompletionTask, ExpressionError>
Compiles the expression into a concrete VectorCompletionTask.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for VectorCompletionTaskExpression
impl<'arbitrary> Arbitrary<'arbitrary> for VectorCompletionTaskExpression
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 VectorCompletionTaskExpression
impl Clone for VectorCompletionTaskExpression
Source§fn clone(&self) -> VectorCompletionTaskExpression
fn clone(&self) -> VectorCompletionTaskExpression
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de> Deserialize<'de> for VectorCompletionTaskExpression
impl<'de> Deserialize<'de> for VectorCompletionTaskExpression
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 VectorCompletionTaskExpression
impl JsonSchema for VectorCompletionTaskExpression
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 VectorCompletionTaskExpression
impl PartialEq for VectorCompletionTaskExpression
Source§fn eq(&self, other: &VectorCompletionTaskExpression) -> bool
fn eq(&self, other: &VectorCompletionTaskExpression) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for VectorCompletionTaskExpression
Auto Trait Implementations§
impl Freeze for VectorCompletionTaskExpression
impl RefUnwindSafe for VectorCompletionTaskExpression
impl Send for VectorCompletionTaskExpression
impl Sync for VectorCompletionTaskExpression
impl Unpin for VectorCompletionTaskExpression
impl UnsafeUnpin for VectorCompletionTaskExpression
impl UnwindSafe for VectorCompletionTaskExpression
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