pub struct AskUserQuestionTool { /* private fields */ }Expand description
Tool that allows the agent to ask questions to the user.
This is essential for:
- Clarifying ambiguous requirements
- Offering choices between approaches
- Getting user preferences
- Confirming before major changes
Implementations§
Source§impl AskUserQuestionTool
impl AskUserQuestionTool
Sourcepub fn new(
question_tx: Sender<QuestionRequest>,
question_rx: Receiver<QuestionResponse>,
) -> Self
pub fn new( question_tx: Sender<QuestionRequest>, question_rx: Receiver<QuestionResponse>, ) -> Self
Creates a new tool with the given channels.
Sourcepub fn with_channels(
buffer_size: usize,
) -> (Self, Receiver<QuestionRequest>, Sender<QuestionResponse>)
pub fn with_channels( buffer_size: usize, ) -> (Self, Receiver<QuestionRequest>, Sender<QuestionResponse>)
Creates a new tool with fresh channels.
Returns (tool, request_receiver, response_sender) where:
toolis theAskUserQuestionToolinstancerequest_receiverreceives questions from the agentresponse_sendersends user answers back to the agent
Trait Implementations§
Source§impl<Ctx: Send + Sync + 'static> Tool<Ctx> for AskUserQuestionTool
impl<Ctx: Send + Sync + 'static> Tool<Ctx> for AskUserQuestionTool
Source§fn description(&self) -> &'static str
fn description(&self) -> &'static str
Human-readable description of what the tool does
Source§fn input_schema(&self) -> Value
fn input_schema(&self) -> Value
JSON schema for the tool’s input parameters
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 ToolContext<Ctx>,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 ToolContext<Ctx>,
input: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the tool with the given input Read more
Auto Trait Implementations§
impl !Freeze for AskUserQuestionTool
impl !RefUnwindSafe for AskUserQuestionTool
impl Send for AskUserQuestionTool
impl Sync for AskUserQuestionTool
impl Unpin for AskUserQuestionTool
impl UnwindSafe for AskUserQuestionTool
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