pub struct FunctionTool<F>{ /* private fields */ }
Implementations§
Trait Implementations§
Source§impl<F> Tool for FunctionTool<F>
impl<F> Tool for FunctionTool<F>
fn name(&self) -> &str
fn description(&self) -> &str
Source§fn openai_tool_spec(&self) -> Option<Value>
fn openai_tool_spec(&self) -> Option<Value>
Optional OpenAI Chat Completions tool spec for this tool.
Return None if the tool shouldn’t be exposed to the model.
Source§fn is_enabled<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 AgentContext,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_enabled<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 AgentContext,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Whether the tool is enabled in the current context.
Source§fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn call<'life0, 'life1, 'async_trait>(
&'life0 self,
input: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the tool with a string input and return a string output.
Source§fn call_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_ctx: &'life1 AgentContext,
_tool_call_id: Option<&'life2 str>,
input: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn call_with_context<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_ctx: &'life1 AgentContext,
_tool_call_id: Option<&'life2 str>,
input: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<String, AgentError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Optional context-aware call. Default delegates to
call
.Auto Trait Implementations§
impl<F> Freeze for FunctionTool<F>where
F: Freeze,
impl<F> RefUnwindSafe for FunctionTool<F>where
F: RefUnwindSafe,
impl<F> Send for FunctionTool<F>
impl<F> Sync for FunctionTool<F>
impl<F> Unpin for FunctionTool<F>where
F: Unpin,
impl<F> UnwindSafe for FunctionTool<F>where
F: 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