Trait ToolProvider

Source
pub trait ToolProvider: ChatProvider {
    // Required method
    fn chat_with_tools<'life0, 'life1, 'async_trait>(
        &'life0 self,
        request: ChatRequest,
        tools: &'life1 [Tool],
    ) -> Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

Optional trait for providers that support tool/function calling.

This extends ChatProvider to add tool calling capabilities.

Required Methods§

Source

fn chat_with_tools<'life0, 'life1, 'async_trait>( &'life0 self, request: ChatRequest, tools: &'life1 [Tool], ) -> Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Send a chat request with available tools.

§Arguments
  • request - The chat request containing messages and parameters
  • tools - Available tools that the model can call
§Returns

A result containing the response (potentially with tool calls) or an error

Implementors§