pub struct StaticToolProvider<E>where
E: StaticToolExecute,{ /* private fields */ }Expand description
Author a fixed-tool provider without hand-rolling tool_manifests /
resolve_contract: supply the ToolDefinitions once and an
StaticToolExecute for behavior.
A ToolProvider that serves a fixed set of ToolDefinitions from a
cache, delegating execution to an StaticToolExecute.
Implementations§
Source§impl<E> StaticToolProvider<E>where
E: StaticToolExecute,
impl<E> StaticToolProvider<E>where
E: StaticToolExecute,
Sourcepub fn new(
definitions: Vec<ToolDefinition>,
executor: E,
) -> StaticToolProvider<E>
pub fn new( definitions: Vec<ToolDefinition>, executor: E, ) -> StaticToolProvider<E>
Build a provider from a fixed set of definitions and an executor.
Manifests and contracts are derived once, here, and reused for the life of the provider.
Trait Implementations§
Source§impl<E> ToolProvider for StaticToolProvider<E>where
E: StaticToolExecute,
impl<E> ToolProvider for StaticToolProvider<E>where
E: StaticToolExecute,
fn tool_manifests(&self) -> Vec<ToolManifest>
fn resolve_manifest(&self, name: &str) -> Option<ToolManifest>
fn resolve_manifest_by_id(&self, id: &ToolId) -> Option<ToolManifest>
fn resolve_contract(&self, name: &str) -> Option<Arc<ToolContract>>
fn resolve_contract_by_id(&self, id: &ToolId) -> Option<Arc<ToolContract>>
fn prepare_tool_call<'life0, 'life1, 'async_trait>(
&'life0 self,
call: ToolPrepareCall<'life1>,
) -> Pin<Box<dyn Future<Output = Result<PreparedToolCall, ToolResult>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
StaticToolProvider<E>: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
call: ToolCall<'life1>,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
StaticToolProvider<E>: 'async_trait,
fn execute_by_id<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
tool_id: &'life1 ToolId,
args: &'life2 Value,
context: &'life3 ToolContext<'life4>,
progress: Option<&'life5 UnboundedSender<SandboxMessage>>,
) -> Pin<Box<dyn Future<Output = ToolResult> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Self: 'async_trait,
Auto Trait Implementations§
impl<E> Freeze for StaticToolProvider<E>where
E: Freeze,
impl<E> RefUnwindSafe for StaticToolProvider<E>where
E: RefUnwindSafe,
impl<E> Send for StaticToolProvider<E>
impl<E> Sync for StaticToolProvider<E>
impl<E> Unpin for StaticToolProvider<E>where
E: Unpin,
impl<E> UnsafeUnpin for StaticToolProvider<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for StaticToolProvider<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more