pub struct WebSearchTool { /* private fields */ }Expand description
Web search tool for searching the internet. Supports multiple providers: DuckDuckGo (free), Brave (requires API key), SearXNG (self-hosted, requires instance URL).
The Brave API key is resolved lazily at execution time: if the boot-time key
is missing or still encrypted, the tool re-reads config.toml, decrypts the
[web_search] brave_api_key field, and uses the result. This ensures that
keys set or rotated after boot, and encrypted keys, are correctly picked up.
Implementations§
Source§impl WebSearchTool
impl WebSearchTool
pub fn new( provider: String, brave_api_key: Option<String>, max_results: usize, timeout_secs: u64, ) -> Self
Sourcepub fn new_with_config(
provider: String,
brave_api_key: Option<String>,
searxng_instance_url: Option<String>,
max_results: usize,
timeout_secs: u64,
config_path: PathBuf,
secrets_encrypt: bool,
) -> Self
pub fn new_with_config( provider: String, brave_api_key: Option<String>, searxng_instance_url: Option<String>, max_results: usize, timeout_secs: u64, config_path: PathBuf, secrets_encrypt: bool, ) -> Self
Create a WebSearchTool with config-reload and decryption support.
config_path is the path to config.toml so the tool can re-read the
Brave API key at execution time. secrets_encrypt controls whether the
key is decrypted via SecretStore.
Trait Implementations§
Source§impl Tool for WebSearchTool
impl Tool for WebSearchTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
Human-readable description
Source§fn parameters_schema(&self) -> Value
fn parameters_schema(&self) -> Value
JSON schema for parameters
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Execute the tool with given arguments
Source§fn execute_with_progress<'life0, 'life1, 'async_trait>(
&'life0 self,
args: Value,
_sink: &'life1 dyn ProgressSink,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute_with_progress<'life0, 'life1, 'async_trait>(
&'life0 self,
args: Value,
_sink: &'life1 dyn ProgressSink,
) -> Pin<Box<dyn Future<Output = Result<ToolResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Execute the tool with a progress-notification sink. Read more
Auto Trait Implementations§
impl Freeze for WebSearchTool
impl RefUnwindSafe for WebSearchTool
impl Send for WebSearchTool
impl Sync for WebSearchTool
impl Unpin for WebSearchTool
impl UnsafeUnpin for WebSearchTool
impl UnwindSafe for WebSearchTool
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more