pub enum RemoteFunction {
Scalar {
description: String,
input_schema: InputSchema,
tasks: Vec<TaskExpression>,
},
Vector {
description: String,
input_schema: InputSchema,
tasks: Vec<TaskExpression>,
output_length: Expression,
input_split: Expression,
input_merge: Expression,
},
}Expand description
A remote function with full metadata.
Remote functions are stored as function.json in repositories and
referenced by remote/owner/repository. They include documentation fields
that inline functions lack.
Variants§
Scalar
Produces a single score in [0, 1].
Fields
input_schema: InputSchemaJSON Schema defining the expected input structure.
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
input_schema: InputSchemaJSON Schema defining the expected input structure.
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).
output_length: ExpressionExpression computing the expected output vector length for task outputs.
Receives: input.
input_split: ExpressionExpression 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.
input_merge: ExpressionExpression transforming an array of inputs computed by input_split
into a single Input object for the Function.
Receives: input (as an array).
Implementations§
Source§impl RemoteFunction
impl RemoteFunction
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Returns the function’s description.
Sourcepub fn input_schema(&self) -> &InputSchema
pub fn input_schema(&self) -> &InputSchema
Returns the function’s input schema.
Sourcepub fn tasks(&self) -> &[TaskExpression]
pub fn tasks(&self) -> &[TaskExpression]
Returns the function’s tasks.
Sourcepub fn output_length(&self) -> Option<&Expression>
pub fn output_length(&self) -> Option<&Expression>
Returns the function’s expected output length, if defined (vector functions only).
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<'arbitrary> Arbitrary<'arbitrary> for RemoteFunction
impl<'arbitrary> Arbitrary<'arbitrary> for RemoteFunction
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 RemoteFunction
impl Clone for RemoteFunction
Source§fn clone(&self) -> RemoteFunction
fn clone(&self) -> RemoteFunction
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 RemoteFunction
impl Debug for RemoteFunction
Source§impl<'de> Deserialize<'de> for RemoteFunction
impl<'de> Deserialize<'de> for RemoteFunction
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 RemoteFunction
impl JsonSchema for RemoteFunction
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 RemoteFunction
impl PartialEq for RemoteFunction
Source§fn eq(&self, other: &RemoteFunction) -> bool
fn eq(&self, other: &RemoteFunction) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for RemoteFunction
impl Serialize for RemoteFunction
impl StructuralPartialEq for RemoteFunction
Auto Trait Implementations§
impl Freeze for RemoteFunction
impl RefUnwindSafe for RemoteFunction
impl Send for RemoteFunction
impl Sync for RemoteFunction
impl Unpin for RemoteFunction
impl UnsafeUnpin for RemoteFunction
impl UnwindSafe for RemoteFunction
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