pub trait RunnableExt<Input: Send + Sync + 'static, Output: Send + Sync + 'static>: Runnable<Input, Output>{
// Provided methods
fn pipe<O2, R2>(self, other: R2) -> RunnableSequence<Input, O2>
where O2: Send + Sync + 'static,
R2: Runnable<Output, O2> + Send + Sync + 'static,
R2::Error: Into<LcelError> { ... }
fn into_sequence(self) -> RunnableSequence<Input, Output> { ... }
}Expand description
Extension trait that provides LCEL composition methods for Runnable.
Automatically implemented for all Runnable<I, O> types where
Self::Error: Into<LcelError>.
Provided Methods§
Sourcefn pipe<O2, R2>(self, other: R2) -> RunnableSequence<Input, O2>
fn pipe<O2, R2>(self, other: R2) -> RunnableSequence<Input, O2>
Pipe the output of this runnable into another runnable.
This is the core LCEL composition operator. It creates a
RunnableSequence that executes self first, then passes
the output to other.
§Type Safety
The compiler ensures that the output type of self matches
the input type of other. At runtime, intermediate types
are erased via RunnableAny, but the type relationship
was already proven at compile time.
§Example
let chain = prompt.pipe(llm).pipe(parser);
let result = chain.invoke("What is Rust?".to_string(), None).await?;Sourcefn into_sequence(self) -> RunnableSequence<Input, Output>
fn into_sequence(self) -> RunnableSequence<Input, Output>
Create a RunnableSequence from this runnable as a single step.
Useful when you want to start building a pipeline and add
steps later via pipe().
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".