Struct AndThen

Source
pub struct AndThen<Op1, Op2> { /* private fields */ }

Trait Implementations§

Source§

impl<Op1, Op2> Op for AndThen<Op1, Op2>
where Op1: TryOp, Op2: TryOp<Input = Op1::Output, Error = Op1::Error>,

Source§

type Input = <Op1 as TryOp>::Input

Source§

type Output = Result<<Op2 as TryOp>::Output, <Op1 as TryOp>::Error>

Source§

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
where I: IntoIterator<Item = Self::Input> + Send, I::IntoIter: Send, Self: Sized,

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>>
where F: Fn(Self::Output) -> Input + Send + Sync, Input: Send + Sync, Self: Sized,

Chain a function f to the current op. Read more
Source§

fn then<F, Fut>(self, f: F) -> Sequential<Self, Then<F, Fut::Output>>
where F: Fn(Self::Output) -> Fut + Send + Sync, Fut: Future + Send + Sync, Fut::Output: Send + Sync, Self: Sized,

Same as map but for asynchronous functions Read more
Source§

fn chain<T>(self, op: T) -> Sequential<Self, T>
where T: Op<Input = Self::Output>, Self: Sized,

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,

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 more
Source§

fn prompt<P>(self, prompt: P) -> Sequential<Self, Prompt<P, Self::Output>>
where P: Prompt, Self::Output: Into<String>, Self: Sized,

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 more

Auto Trait Implementations§

§

impl<Op1, Op2> Freeze for AndThen<Op1, Op2>
where Op1: Freeze, Op2: Freeze,

§

impl<Op1, Op2> RefUnwindSafe for AndThen<Op1, Op2>
where Op1: RefUnwindSafe, Op2: RefUnwindSafe,

§

impl<Op1, Op2> Send for AndThen<Op1, Op2>
where Op1: Send, Op2: Send,

§

impl<Op1, Op2> Sync for AndThen<Op1, Op2>
where Op1: Sync, Op2: Sync,

§

impl<Op1, Op2> Unpin for AndThen<Op1, Op2>
where Op1: Unpin, Op2: Unpin,

§

impl<Op1, Op2> UnwindSafe for AndThen<Op1, Op2>
where Op1: UnwindSafe, Op2: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<Op, T, E> TryOp for Op
where Op: Op<Output = Result<T, E>>, T: Send + Sync, E: Send + Sync,

Source§

type Input = <Op as Op>::Input

Source§

type Output = T

Source§

type Error = E

Source§

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
where I: IntoIterator<Item = Self::Input> + Send, I::IntoIter: Send, Self: Sized,

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 more
Source§

fn map_ok<F, Output>(self, f: F) -> MapOk<Self, Map<F, Self::Output>>
where F: Fn(Self::Output) -> Output + Send + Sync, Output: Send + Sync, Self: Sized,

Map the success return value (i.e., Ok) of the current op to a different value using the provided closure. Read more
Source§

fn map_err<F, E>(self, f: F) -> MapErr<Self, Map<F, Self::Error>>
where F: Fn(Self::Error) -> E + Send + Sync, E: Send + Sync, Self: Sized,

Map the error return value (i.e., Err) of the current op to a different value using the provided closure. Read more
Source§

fn and_then<F, Fut, Output>(self, f: F) -> AndThen<Self, Then<F, Self::Output>>
where F: Fn(Self::Output) -> Fut + Send + Sync, Fut: Future<Output = Result<Output, Self::Error>> + Send + Sync, Output: Send + Sync, Self: Sized,

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 more
Source§

fn or_else<F, Fut, E>(self, f: F) -> OrElse<Self, Then<F, Self::Error>>
where F: Fn(Self::Error) -> Fut + Send + Sync, Fut: Future<Output = Result<Self::Output, E>> + Send + Sync, E: Send + Sync, Self: Sized,

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 more
Source§

fn chain_ok<T>(self, op: T) -> TrySequential<Self, T>
where T: Op<Input = Self::Output>, Self: Sized,

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
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T