pub struct AndThen<Op1, Op2> { /* private fields */ }
Trait Implementations§
Source§impl<Op1, Op2> Op for AndThen<Op1, Op2>
impl<Op1, Op2> Op for AndThen<Op1, Op2>
type Input = <Op1 as TryOp>::Input
type Output = Result<<Op2 as TryOp>::Output, <Op1 as TryOp>::Error>
async fn call(&self, input: Self::Input) -> Self::Output
Source§fn batch_call<I>(
&self,
n: usize,
input: I,
) -> impl Future<Output = Vec<Self::Output>> + Send
fn batch_call<I>( &self, n: usize, input: I, ) -> impl Future<Output = Vec<Self::Output>> + Send
Execute the current pipeline with the given inputs.
n
is the number of concurrent
inputs that will be processed concurrently.Source§fn map<F, Input>(self, f: F) -> Sequential<Self, Map<F, Self::Output>>
fn map<F, Input>(self, f: F) -> Sequential<Self, Map<F, Self::Output>>
Chain a function
f
to the current op. Read moreSource§fn then<F, Fut>(self, f: F) -> Sequential<Self, Then<F, Fut::Output>>
fn then<F, Fut>(self, f: F) -> Sequential<Self, Then<F, Fut::Output>>
Same as
map
but for asynchronous functions Read moreSource§fn chain<T>(self, op: T) -> Sequential<Self, T>
fn chain<T>(self, op: T) -> Sequential<Self, T>
Chain an arbitrary operation to the current op. Read more
Source§fn lookup<I, Input>(
self,
index: I,
n: usize,
) -> Sequential<Self, Lookup<I, Self::Output, Input>>where
I: VectorStoreIndex,
Input: Send + Sync + for<'a> Deserialize<'a>,
Self::Output: Into<String>,
Self: Sized,
fn lookup<I, Input>(
self,
index: I,
n: usize,
) -> Sequential<Self, Lookup<I, Self::Output, Input>>where
I: VectorStoreIndex,
Input: Send + Sync + for<'a> Deserialize<'a>,
Self::Output: Into<String>,
Self: Sized,
Chain a lookup operation to the current chain. The lookup operation expects the
current chain to output a query string. The lookup operation will use the query to
retrieve the top
n
documents from the index and return them with the query string. Read moreSource§fn prompt<P>(self, prompt: P) -> Sequential<Self, Prompt<P, Self::Output>>
fn prompt<P>(self, prompt: P) -> Sequential<Self, Prompt<P, Self::Output>>
Chain a prompt operation to the current chain. The prompt operation expects the
current chain to output a string. The prompt operation will use the string to prompt
the given agent (or any other type that implements the
Prompt
trait) and return
the response. Read moreAuto Trait Implementations§
impl<Op1, Op2> Freeze for AndThen<Op1, Op2>
impl<Op1, Op2> RefUnwindSafe for AndThen<Op1, Op2>where
Op1: RefUnwindSafe,
Op2: RefUnwindSafe,
impl<Op1, Op2> Send for AndThen<Op1, Op2>
impl<Op1, Op2> Sync for AndThen<Op1, Op2>
impl<Op1, Op2> Unpin for AndThen<Op1, Op2>
impl<Op1, Op2> UnwindSafe for AndThen<Op1, Op2>where
Op1: UnwindSafe,
Op2: UnwindSafe,
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
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<Op, T, E> TryOp for Op
impl<Op, T, E> TryOp for Op
type Input = <Op as Op>::Input
type Output = T
type Error = E
Source§async fn try_call(
&self,
input: <Op as TryOp>::Input,
) -> Result<<Op as TryOp>::Output, <Op as TryOp>::Error>
async fn try_call( &self, input: <Op as TryOp>::Input, ) -> Result<<Op as TryOp>::Output, <Op as TryOp>::Error>
Execute the current op with the given input.
Source§fn try_batch_call<I>(
&self,
n: usize,
input: I,
) -> impl Future<Output = Result<Vec<Self::Output>, Self::Error>> + Send
fn try_batch_call<I>( &self, n: usize, input: I, ) -> impl Future<Output = Result<Vec<Self::Output>, Self::Error>> + Send
Execute the current op with the given inputs.
n
is the number of concurrent
inputs that will be processed concurrently.
If the op fails for one of the inputs, the entire operation will fail and the error will
be returned. Read moreSource§fn map_ok<F, Output>(self, f: F) -> MapOk<Self, Map<F, Self::Output>>
fn map_ok<F, Output>(self, f: F) -> MapOk<Self, Map<F, Self::Output>>
Map the success return value (i.e.,
Ok
) of the current op to a different value
using the provided closure. Read moreSource§fn map_err<F, E>(self, f: F) -> MapErr<Self, Map<F, Self::Error>>
fn map_err<F, E>(self, f: F) -> MapErr<Self, Map<F, Self::Error>>
Map the error return value (i.e.,
Err
) of the current op to a different value
using the provided closure. Read moreSource§fn and_then<F, Fut, Output>(self, f: F) -> AndThen<Self, Then<F, Self::Output>>
fn and_then<F, Fut, Output>(self, f: F) -> AndThen<Self, Then<F, Self::Output>>
Chain a function to the current op. The function will only be called
if the current op returns
Ok
. The function must return a Future
with value
Result<T, E>
where E
is the same type as the error type of the current. Read moreSource§fn or_else<F, Fut, E>(self, f: F) -> OrElse<Self, Then<F, Self::Error>>
fn or_else<F, Fut, E>(self, f: F) -> OrElse<Self, Then<F, Self::Error>>
Chain a function
f
to the current op. The function f
will only be called
if the current op returns Err
. f
must return a Future
with value
Result<T, E>
where T
is the same type as the output type of the current op. Read moreSource§fn chain_ok<T>(self, op: T) -> TrySequential<Self, T>
fn chain_ok<T>(self, op: T) -> TrySequential<Self, T>
Chain a new op
op
to the current op. The new op will be called with the success
return value of the current op (i.e.: Ok
value). The chained op can be any type that
implements the Op
trait. Read more