Skip to main content

RunnableAny

Trait RunnableAny 

Source
pub trait RunnableAny: Send + Sync {
    // Required methods
    fn invoke_any<'life0, 'async_trait>(
        &'life0 self,
        input: Box<dyn Any + Send>,
        config: Option<RunnableConfig>,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Any + Send>, LcelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stream_any<'life0, 'async_trait>(
        &'life0 self,
        input: Box<dyn Any + Send>,
        config: Option<RunnableConfig>,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Box<dyn Any + Send>, LcelError>> + Send>>, LcelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn transform_any<'life0, 'async_trait>(
        &'life0 self,
        input: Pin<Box<dyn Stream<Item = Result<Box<dyn Any + Send>, LcelError>> + Send>>,
        config: Option<RunnableConfig>,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Box<dyn Any + Send>, LcelError>> + Send>>, LcelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn batch_any<'life0, 'async_trait>(
        &'life0 self,
        inputs: Vec<Box<dyn Any + Send>>,
        config: Option<RunnableConfig>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Box<dyn Any + Send>>, LcelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Type-erased Runnable with unified LcelError.

This trait is the runtime representation of a Runnable<I, O> step inside a RunnableSequence. All generic types are erased to Box<dyn Any + Send>.

Required Methods§

Source

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

Type-erased invoke: Box<dyn Any + Send>Box<dyn Any + Send>.

Source

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

Type-erased stream: Box<dyn Any + Send> → Stream of Box<dyn Any + Send>.

Source

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

Type-erased transform: Stream of Box<dyn Any + Send> → Stream of Box<dyn Any + Send>.

This is the core of LCEL streaming: each step takes an input stream and produces an output stream, enabling pipeline streaming without buffering intermediate results.

Source

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

Type-erased batch: Vec<Box<dyn Any + Send>>Vec<Box<dyn Any + Send>>.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<I, O, R> RunnableAny for RunnableAnyWrapper<I, O, R>
where I: Send + Sync + 'static, O: Send + Sync + 'static, R: Runnable<I, O> + 'static, R::Error: Into<LcelError>,