pub enum InlineFunction {
Scalar {
tasks: Vec<TaskExpression>,
},
Vector {
tasks: Vec<TaskExpression>,
input_split: Option<Expression>,
input_merge: Option<Expression>,
},
}Expand description
An inline function definition without metadata.
Used when embedding function logic directly in requests rather than referencing a remote function. Lacks description and input schema fields.
Variants§
Scalar
Produces a single score in [0, 1].
Fields
tasks: Vec<TaskExpression>The list of tasks to execute. Tasks with a map expression are
expanded into multiple instances. Each instance is compiled with
map set to the current integer index.
Receives: input, map (if mapped).
Vector
Produces a vector of scores that sums to 1.
Fields
tasks: Vec<TaskExpression>The list of tasks to execute. Tasks with a map expression are
expanded into multiple instances. Each instance is compiled with
map set to the current integer index.
Receives: input, map (if mapped).
input_split: Option<Expression>Expression transforming input into an input array of the output_length
When the Function is executed with any input from the array,
The output_length should be 1.
Receives: input.
Only required if the request uses a strategy that needs input splitting.
input_merge: Option<Expression>Expression transforming an array of inputs computed by input_split
into a single Input object for the Function.
Receives: input (as an array).
Only required if the request uses a strategy that needs input splitting.
Implementations§
Source§impl InlineFunction
impl InlineFunction
Sourcepub fn tasks(&self) -> &[TaskExpression]
pub fn tasks(&self) -> &[TaskExpression]
Returns the function’s tasks.
Sourcepub fn input_split(&self) -> Option<&Expression>
pub fn input_split(&self) -> Option<&Expression>
Returns the function’s input_split expression, if defined (vector functions only).
Sourcepub fn input_merge(&self) -> Option<&Expression>
pub fn input_merge(&self) -> Option<&Expression>
Returns the function’s input_merge expression, if defined (vector functions only).
pub fn remotes(&self) -> impl Iterator<Item = &RemotePath>
Trait Implementations§
Source§impl Clone for InlineFunction
impl Clone for InlineFunction
Source§fn clone(&self) -> InlineFunction
fn clone(&self) -> InlineFunction
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 InlineFunction
impl Debug for InlineFunction
Source§impl<'de> Deserialize<'de> for InlineFunction
impl<'de> Deserialize<'de> for InlineFunction
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 InlineFunction
impl JsonSchema for InlineFunction
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 InlineFunction
impl PartialEq for InlineFunction
Source§fn eq(&self, other: &InlineFunction) -> bool
fn eq(&self, other: &InlineFunction) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for InlineFunction
impl Serialize for InlineFunction
impl StructuralPartialEq for InlineFunction
Auto Trait Implementations§
impl Freeze for InlineFunction
impl RefUnwindSafe for InlineFunction
impl Send for InlineFunction
impl Sync for InlineFunction
impl Unpin for InlineFunction
impl UnsafeUnpin for InlineFunction
impl UnwindSafe for InlineFunction
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