pub struct WebSearch {
pub search_engine: SearchEngine,
pub enable: Option<bool>,
pub search_query: Option<String>,
pub search_intent: Option<bool>,
pub count: Option<u32>,
pub search_domain_filter: Option<String>,
pub search_recency_filter: Option<SearchRecencyFilter>,
pub content_size: Option<ContentSize>,
pub result_sequence: Option<ResultSequence>,
pub search_result: Option<bool>,
pub require_search: Option<bool>,
pub search_prompt: Option<String>,
}Expand description
This structure represents a web search tool that can perform internet searches. Fields mirror the external web_search schema.
Fields§
§search_engine: SearchEngineSearch engine type (required). Supported: search_std, search_pro, search_pro_sogou, search_pro_quark.
enable: Option<bool>Whether to enable web search. Default is false.
search_query: Option<String>Force-triggered search query string.
search_intent: Option<bool>Whether to perform search intent detection. true: execute only when intent is detected; false: skip detection and search directly.
count: Option<u32>Number of results to return (1-50).
search_domain_filter: Option<String>Whitelist domain filter, e.g., “www.example.com”.
search_recency_filter: Option<SearchRecencyFilter>Time range filter.
content_size: Option<ContentSize>Snippet summary size: medium or high.
result_sequence: Option<ResultSequence>Return sequence for search results: before or after.
search_result: Option<bool>Whether to include detailed search source information.
require_search: Option<bool>Whether an answer requires search results to be returned.
search_prompt: Option<String>Custom prompt to post-process search results.
Implementations§
Source§impl WebSearch
impl WebSearch
Sourcepub fn new(search_engine: SearchEngine) -> Self
pub fn new(search_engine: SearchEngine) -> Self
Create a WebSearch config with the required search engine; other fields are optional.
Sourcepub fn with_enable(self, enable: bool) -> Self
pub fn with_enable(self, enable: bool) -> Self
Enable or disable web search.
Sourcepub fn with_search_query(self, query: impl Into<String>) -> Self
pub fn with_search_query(self, query: impl Into<String>) -> Self
Set a forced search query.
Sourcepub fn with_search_intent(self, search_intent: bool) -> Self
pub fn with_search_intent(self, search_intent: bool) -> Self
Set search intent detection behavior.
Sourcepub fn with_count(self, count: u32) -> Self
pub fn with_count(self, count: u32) -> Self
Set results count (1-50).
Sourcepub fn with_search_domain_filter(self, domain: impl Into<String>) -> Self
pub fn with_search_domain_filter(self, domain: impl Into<String>) -> Self
Restrict to a whitelist domain.
Sourcepub fn with_search_recency_filter(self, filter: SearchRecencyFilter) -> Self
pub fn with_search_recency_filter(self, filter: SearchRecencyFilter) -> Self
Set time range filter.
Sourcepub fn with_content_size(self, size: ContentSize) -> Self
pub fn with_content_size(self, size: ContentSize) -> Self
Set content size.
Sourcepub fn with_result_sequence(self, seq: ResultSequence) -> Self
pub fn with_result_sequence(self, seq: ResultSequence) -> Self
Set result sequence.
Sourcepub fn with_search_result(self, enable: bool) -> Self
pub fn with_search_result(self, enable: bool) -> Self
Toggle returning detailed search source info.
Sourcepub fn with_require_search(self, require: bool) -> Self
pub fn with_require_search(self, require: bool) -> Self
Require search results for answering.
Sourcepub fn with_search_prompt(self, prompt: impl Into<String>) -> Self
pub fn with_search_prompt(self, prompt: impl Into<String>) -> Self
Set a custom prompt to post-process search results.