Skip to main content

ToolProvider

Trait ToolProvider 

Source
pub trait ToolProvider: Send + Sync {
    // Required method
    fn call_tool<'life0, 'async_trait>(
        &'life0 self,
        call: HostToolCall,
    ) -> Pin<Box<dyn Future<Output = Result<HostToolResult, ToolCallError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Native tools implemented by the app.

call_tool is a suspend fun in Kotlin and an async throws function in Swift. It is called from the runtime’s threads, possibly for several calls at once; it is cancelled when its time limit passes or the run is aborted.

Required Methods§

Source

fn call_tool<'life0, 'async_trait>( &'life0 self, call: HostToolCall, ) -> Pin<Box<dyn Future<Output = Result<HostToolResult, ToolCallError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Run one tool call. Throw ToolCallError::Failed to tell the model why it failed.

Trait Implementations§

Source§

impl<T> FfiConverterArc<T> for dyn ToolProvider

Source§

const TYPE_ID_META: MetadataBuffer

Source§

type FfiType = Handle

Source§

fn lower(obj: Arc<Self>) -> Self::FfiType

Source§

fn try_lift(handle: Self::FfiType) -> Result<Arc<Self>>

Source§

fn write(obj: Arc<Self>, buf: &mut Vec<u8>)

Source§

fn try_read(buf: &mut &[u8]) -> Result<Arc<Self>>

Source§

impl<T> LiftRef<T> for dyn ToolProvider

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§