Skip to main content

ToolExecutor

Trait ToolExecutor 

Source
pub trait ToolExecutor: Send + Sync {
    // Required methods
    fn definition(&self) -> &ToolDefinition;
    fn execute<'life0, 'async_trait>(
        &'life0 self,
        arguments: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn validate(&self, arguments: &Value) -> Result<(), Error> { ... }
}
Expand description

工具执行器 trait

Required Methods§

Source

fn definition(&self) -> &ToolDefinition

获取工具定义

Source

fn execute<'life0, 'async_trait>( &'life0 self, arguments: Value, ) -> Pin<Box<dyn Future<Output = Result<Value, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

执行工具

Provided Methods§

Source

fn validate(&self, arguments: &Value) -> Result<(), Error>

验证参数

Implementors§