pub struct WebSearchTool;Expand description
P4c (S2 module 5 tools.web): perform a web search.
BP-2 (catalog:45, “supercode bundles no search backend” closed): the
tool works out of the box against DuckDuckGo’s public HTML endpoint
(DEFAULT_WEB_SEARCH_URL) — the same “no key, no account” surface a
browser gets — and an operator can point it anywhere else with
WEB_SEARCH_URL_ENV, which keeps its existing <url>?q=<query>
contract. Results are extracted into a numbered title/url/snippet list;
a page whose markup this does not recognize falls back to the page as
markdown rather than to a claim of zero hits. A backend that cannot be
reached says so, naming the endpoint it tried and the override.
Trait Implementations§
Source§impl Tool for WebSearchTool
impl Tool for WebSearchTool
Source§fn description(&self) -> &str
fn description(&self) -> &str
The built-in description. May be overridden via
crate::Config.Source§fn parameters(&self) -> Value
fn parameters(&self) -> Value
JSON Schema describing the tool’s input object.
Source§fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
args: Value,
ctx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn execute<'life0, 'life1, 'async_trait>(
&'life0 self,
args: Value,
ctx: &'life1 ToolContext,
) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Run the tool. Returns text to feed back to the model.
Source§fn structured_output(&self) -> bool
fn structured_output(&self) -> bool
Whether a successful textual result is also a complete JSON value
that protocol adapters should expose as structured output. Text
remains the model-facing representation, preserving compatibility.
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