pub struct TypedSequentialFlow<I, O> { /* private fields */ }Expand description
Implementations§
Source§impl TypedSequentialFlow<(), ()>
impl TypedSequentialFlow<(), ()>
Sourcepub fn start_with<A>(
name: impl Into<String>,
agent: A,
) -> TypedSequentialFlow<A::Input, A::Output>
pub fn start_with<A>( name: impl Into<String>, agent: A, ) -> TypedSequentialFlow<A::Input, A::Output>
Start a typed pipeline with a named klieo_core::agent::Agent as the first stage.
Equivalent to TypedSequentialFlow::new with an auto-wrapping
closure, but takes any concrete klieo_core::agent::Agent directly
— no manual map_err needed.
§Example
ⓘ
use klieo_flows::TypedSequentialFlow;
// `Classifier` implements `klieo_core::agent::Agent`.
let flow = TypedSequentialFlow::start_with("pipeline", Classifier)
.then_agent(Retriever)
.then_agent(Drafter);Source§impl<I, O> TypedSequentialFlow<I, O>
impl<I, O> TypedSequentialFlow<I, O>
Sourcepub fn new<F, Fut>(name: impl Into<String>, stage: F) -> Self
pub fn new<F, Fut>(name: impl Into<String>, stage: F) -> Self
Start a typed pipeline with the given name and first stage.
Sourcepub fn then_agent<A>(self, agent: A) -> TypedSequentialFlow<I, A::Output>
pub fn then_agent<A>(self, agent: A) -> TypedSequentialFlow<I, A::Output>
Append a stage from a concrete klieo_core::agent::Agent.
The agent’s Input must match
this flow’s current output type O. Returns a new
TypedSequentialFlow<I, A::Output>.
Sourcepub fn then<F, Fut, P>(self, stage: F) -> TypedSequentialFlow<I, P>
pub fn then<F, Fut, P>(self, stage: F) -> TypedSequentialFlow<I, P>
Append a stage that consumes the previous output type O and
produces a new output type P.
Sourcepub async fn run(&self, ctx: AgentContext, input: I) -> Result<O, FlowError>
pub async fn run(&self, ctx: AgentContext, input: I) -> Result<O, FlowError>
Run the pipeline end-to-end. The composed stage chain is wrapped
in a single typed_sequential_flow.run tracing span.
Auto Trait Implementations§
impl<I, O> !RefUnwindSafe for TypedSequentialFlow<I, O>
impl<I, O> !UnwindSafe for TypedSequentialFlow<I, O>
impl<I, O> Freeze for TypedSequentialFlow<I, O>
impl<I, O> Send for TypedSequentialFlow<I, O>
impl<I, O> Sync for TypedSequentialFlow<I, O>
impl<I, O> Unpin for TypedSequentialFlow<I, O>
impl<I, O> UnsafeUnpin for TypedSequentialFlow<I, O>
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
Mutably borrows from an owned value. Read more