Trait Tool

Source
pub trait Tool:
    Send
    + Sync
    + DynClone {
    // Required methods
    fn invoke<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        agent_context: &'life1 dyn AgentContext,
        raw_args: Option<&'life2 str>,
    ) -> Pin<Box<dyn Future<Output = Result<ToolOutput, ToolError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn name(&self) -> &'static str;
    fn tool_spec(&self) -> ToolSpec;

    // Provided method
    fn boxed<'a>(self) -> Box<dyn Tool + 'a>
       where Self: Sized + 'a { ... }
}

Required Methods§

Source

fn invoke<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, agent_context: &'life1 dyn AgentContext, raw_args: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<ToolOutput, ToolError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn name(&self) -> &'static str

Source

fn tool_spec(&self) -> ToolSpec

Provided Methods§

Source

fn boxed<'a>(self) -> Box<dyn Tool + 'a>
where Self: Sized + 'a,

Trait Implementations§

Source§

impl Hash for Box<dyn Tool>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Box<dyn Tool>

Tools are identified and unique by name These allow comparison and lookups

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Tool for Box<dyn Tool>

Source§

fn invoke<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, agent_context: &'life1 dyn AgentContext, raw_args: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<ToolOutput, ToolError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn name(&self) -> &'static str

Source§

fn tool_spec(&self) -> ToolSpec

Source§

fn boxed<'a>(self) -> Box<dyn Tool + 'a>
where Self: Sized + 'a,

Source§

impl Eq for Box<dyn Tool>

Implementations on Foreign Types§

Source§

impl Tool for Box<dyn Tool>

Source§

fn invoke<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, agent_context: &'life1 dyn AgentContext, raw_args: Option<&'life2 str>, ) -> Pin<Box<dyn Future<Output = Result<ToolOutput, ToolError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn name(&self) -> &'static str

Source§

fn tool_spec(&self) -> ToolSpec

Implementors§