Trait TaskNode

Source
pub trait TaskNode:
    Send
    + Sync
    + DynClone
    + Any {
    type Input: NodeArg;
    type Output: NodeArg;
    type Error: Error + Send + Sync + 'static;

    // Required method
    fn evaluate<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        node_id: &'life1 DynNodeId<Self>,
        input: &'life2 Self::Input,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}

Required Associated Types§

Required Methods§

Source

fn evaluate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, node_id: &'life1 DynNodeId<Self>, input: &'life2 Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Trait Implementations§

Source§

impl<Input: NodeArg, Output: NodeArg, Error: Error + Send + Sync + 'static> TaskNode for Box<dyn TaskNode<Input = Input, Output = Output, Error = Error>>

Source§

type Input = Input

Source§

type Output = Output

Source§

type Error = Error

Source§

fn evaluate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, node_id: &'life1 NodeId<dyn TaskNode<Input = Self::Input, Output = Self::Output, Error = Self::Error>>, input: &'life2 Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Implementations on Foreign Types§

Source§

impl TaskNode for Box<dyn ToolExecutor>

Source§

type Input = Command

Source§

type Output = CommandOutput

Source§

type Error = CommandError

Source§

fn evaluate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _node_id: &'life1 NodeId<dyn TaskNode<Input = Self::Input, Output = Self::Output, Error = Self::Error>>, input: &'life2 Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

impl TaskNode for Box<dyn ChatCompletion>

Source§

type Input = ChatCompletionRequest

Source§

type Output = ChatCompletionResponse

Source§

type Error = LanguageModelError

Source§

fn evaluate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _node_id: &'life1 NodeId<dyn TaskNode<Input = Self::Input, Output = Self::Output, Error = Self::Error>>, input: &'life2 Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

impl TaskNode for Box<dyn SimplePrompt>

Source§

type Input = Prompt

Source§

type Output = String

Source§

type Error = LanguageModelError

Source§

fn evaluate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _node_id: &'life1 NodeId<dyn TaskNode<Input = Self::Input, Output = Self::Output, Error = Self::Error>>, input: &'life2 Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

impl TaskNode for Arc<dyn ToolExecutor>

Source§

type Input = Command

Source§

type Output = CommandOutput

Source§

type Error = CommandError

Source§

fn evaluate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _node_id: &'life1 NodeId<dyn TaskNode<Input = Self::Input, Output = Self::Output, Error = Self::Error>>, input: &'life2 Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

impl TaskNode for Arc<dyn ChatCompletion>

Source§

type Input = ChatCompletionRequest

Source§

type Output = ChatCompletionResponse

Source§

type Error = LanguageModelError

Source§

fn evaluate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _node_id: &'life1 NodeId<dyn TaskNode<Input = Self::Input, Output = Self::Output, Error = Self::Error>>, input: &'life2 Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

impl TaskNode for Arc<dyn SimplePrompt>

Source§

type Input = Prompt

Source§

type Output = String

Source§

type Error = LanguageModelError

Source§

fn evaluate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _node_id: &'life1 NodeId<dyn TaskNode<Input = Self::Input, Output = Self::Output, Error = Self::Error>>, input: &'life2 Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

impl<I: NodeArg, O: NodeArg, E: Error + Send + Sync + 'static> TaskNode for fn(&I) -> Result<O, E>

Source§

type Input = I

Source§

type Output = O

Source§

type Error = E

Source§

fn evaluate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _node_id: &'life1 NodeId<dyn TaskNode<Input = Self::Input, Output = Self::Output, Error = Self::Error>>, input: &'life2 Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

impl<Input: NodeArg, Output: NodeArg, Error: Error + Send + Sync + 'static> TaskNode for Box<dyn TaskNode<Input = Input, Output = Output, Error = Error>>

Source§

type Input = Input

Source§

type Output = Output

Source§

type Error = Error

Source§

fn evaluate<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, node_id: &'life1 NodeId<dyn TaskNode<Input = Self::Input, Output = Self::Output, Error = Self::Error>>, input: &'life2 Self::Input, ) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Implementors§

Source§

impl TaskNode for TaskAgent

A ‘default’ implementation for an agent where there is no output

TODO: Make this nicer :))

Source§

impl<Context: NodeArg + Clone> TaskNode for NoopNode<Context>

Source§

impl<F, I, O> TaskNode for SyncClosureTaskNode<F, I, O>
where F: Fn(&I) -> Result<O, NodeError> + Clone + Send + Sync + 'static, I: NodeArg + Clone, O: NodeArg + Clone,