Node

Trait Node 

Source
pub trait Node: Debug {
    type Input;
    type Output;

    // Required method
    fn process<'life0, 'async_trait>(
        &'life0 self,
        input: Self::Input,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, AnchorChainError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Represents a node that can process an input to produce an output.

The Node trait defines a generic processing operation with a specified input and output type. Implementors of this trait can be composed together to form a processing chain.

Required Associated Types§

Source

type Input

The input type for the node.

Source

type Output

The output type for the node.

Required Methods§

Source

fn process<'life0, 'async_trait>( &'life0 self, input: Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, AnchorChainError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Asynchronously processes the given input, returning the output. When chained together the output type of one node must match the input of the next node in the chain.

Implementors§

Source§

impl Node for Claude3Bedrock

Source§

impl Node for Ollama

Source§

impl Node for OpenAIEmbeddingModel

Source§

impl Node for Prompt

Implements the Node trait for the Prompt struct.

Source§

impl<C, N> Node for Link<C, N>
where C: Node + Send + Sync + Debug, C::Output: Send + 'static, C::Input: Send, N: Node<Input = C::Output> + Send + Sync + Debug, N::Output: Send,

Source§

type Input = <C as Node>::Input

Source§

type Output = <N as Node>::Output

Source§

impl<I, O, C> Node for ParallelNode<I, O, C>
where I: Clone + Send + Sync + Debug, O: Send + Sync + Debug, C: Send + Sync + Debug,

Source§

type Input = I

Source§

type Output = C

Source§

impl<I, O, L> Node for Chain<I, O, L>
where L: Node<Input = I, Output = O> + Send + Sync + Debug, I: Debug + Send + Sync, O: Debug + Send + Sync,

Source§

type Input = I

Source§

type Output = O

Source§

impl<M: EmbeddingModel + Debug + Send + Sync> Node for OpenSearchIndexer<M>

Source§

impl<M: EmbeddingModel + Debug + Send + Sync> Node for OpenSearchRetriever<M>

Source§

impl<T> Node for OpenAIModel<T>

Source§

impl<T> Node for OpenAIChatModel<T>

Source§

impl<T> Node for OpenAIInstructModel<T>
where T: Into<Prompt> + Debug + Send + Sync,

Source§

impl<T> Node for Logger<T>
where T: Debug + Send + Sync,

Source§

type Input = T

Source§

type Output = T

Source§

impl<T> Node for NoOpNode<T>
where T: Send + Sync + Debug,

Source§

type Input = T

Source§

type Output = T