Trait Runnable

Source
pub trait Runnable<Input, Output>:
    Send
    + Sync
    + 'static
where Input: Send + Sync + 'static, Output: Send + Sync + 'static,
{ // Required method fn invoke<'life0, 'async_trait>( &'life0 self, input: Input, config: Option<RunnableConfig>, ) -> Pin<Box<dyn Future<Output = Result<Output>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn invoke_simple<'life0, 'async_trait>( &'life0 self, input: Input, ) -> Pin<Box<dyn Future<Output = Result<Output>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn batch<'life0, 'async_trait>( &'life0 self, inputs: Vec<Input>, config: Option<RunnableConfig>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Output>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn stream<'life0, 'async_trait>( &'life0 self, input: Input, config: Option<RunnableConfig>, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Output>> + Send>>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn input_schema(&self) -> Option<Value> { ... } fn output_schema(&self) -> Option<Value> { ... } fn config_schema(&self) -> Option<Value> { ... } }
Expand description

The core Runnable trait that all FerricLink components implement

Required Methods§

Source

fn invoke<'life0, 'async_trait>( &'life0 self, input: Input, config: Option<RunnableConfig>, ) -> Pin<Box<dyn Future<Output = Result<Output>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Invoke the runnable with a single input

Provided Methods§

Source

fn invoke_simple<'life0, 'async_trait>( &'life0 self, input: Input, ) -> Pin<Box<dyn Future<Output = Result<Output>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Invoke the runnable with a single input (convenience method with default config)

Source

fn batch<'life0, 'async_trait>( &'life0 self, inputs: Vec<Input>, config: Option<RunnableConfig>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Output>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Batch invoke the runnable with multiple inputs

Source

fn stream<'life0, 'async_trait>( &'life0 self, input: Input, config: Option<RunnableConfig>, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Output>> + Send>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Stream the output of the runnable

Source

fn input_schema(&self) -> Option<Value>

Get the input schema for this runnable

Source

fn output_schema(&self) -> Option<Value>

Get the output schema for this runnable

Source

fn config_schema(&self) -> Option<Value>

Get the configuration schema for this runnable

Implementors§

Source§

impl<F, Input, Output> Runnable<Input, Output> for RunnableLambda<F, Input, Output>
where F: Fn(Input) -> Result<Output> + Send + Sync + 'static, Input: Send + Sync + 'static, Output: Send + Sync + 'static,

Source§

impl<F, Input, Output, Fut> Runnable<Input, Output> for RunnableAsync<F, Input, Output, Fut>
where F: Fn(Input) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<Output>> + Send + 'static, Input: Send + Sync + 'static, Output: Send + Sync + 'static,

Source§

impl<Input, Intermediate, Output> Runnable<Input, Output> for RunnableSequence<Input, Intermediate, Output>
where Input: Send + Sync + 'static, Intermediate: Send + Sync + 'static, Output: Send + Sync + 'static,

Source§

impl<Input, Output> Runnable<Input, Vec<Output>> for RunnableParallel<Input, Output>
where Input: Send + Sync + 'static + Clone, Output: Send + Sync + 'static,

Source§

impl<R> Runnable<String, RetrieverResult> for RunnableRetriever<R>
where R: BaseRetriever,

Source§

impl<T> Runnable<HashMap<String, Value>, ToolResult> for RunnableTool<T>
where T: Tool,