pub trait TypedCollection: Send + Sync {
// Required methods
fn names(&self) -> Vec<&'static str>;
fn declarations(&self) -> Result<Value, ToolError>;
fn decide(&self, call: &FunctionCall) -> Action;
fn call<'a>(
&'a self,
call: FunctionCall,
) -> Pin<Box<dyn Future<Output = Result<FunctionResponse, ToolError>> + Send + 'a>>;
}Expand description
Type-erased view of a tool collection used by the chat loop.
Implementations wrap a typed ToolCollection<M> + a decision strategy.
The M disappears behind the trait object; the chat loop works
uniformly over any collection that speaks this interface.
Required Methods§
Sourcefn names(&self) -> Vec<&'static str>
fn names(&self) -> Vec<&'static str>
Every tool name this collection owns. Used at builder time to populate the routing table and detect collisions with other collections.
Sourcefn declarations(&self) -> Result<Value, ToolError>
fn declarations(&self) -> Result<Value, ToolError>
Tool declarations as the providers need them, in the same shape
ToolCollection::json returns today.
Sourcefn decide(&self, call: &FunctionCall) -> Action
fn decide(&self, call: &FunctionCall) -> Action
Ask the strategy what to do with this call. Pure decision — no side effects.
Sourcefn call<'a>(
&'a self,
call: FunctionCall,
) -> Pin<Box<dyn Future<Output = Result<FunctionResponse, ToolError>> + Send + 'a>>
fn call<'a>( &'a self, call: FunctionCall, ) -> Pin<Box<dyn Future<Output = Result<FunctionResponse, ToolError>> + Send + 'a>>
Actually execute the call. Called by the executor once a tool has been approved (auto or manually).