pub struct WebSearchToolResultBlock {
pub content: WebSearchToolResultBlockContent,
pub tool_use_id: String,
pub cache_control: Option<CacheControlEphemeral>,
}Expand description
A block containing the results of a web search tool operation.
WebSearchToolResultBlock contains either a list of search results or an error.
Fields§
§content: WebSearchToolResultBlockContentThe content of the web search tool result.
tool_use_id: StringThe ID of the tool use that this result is for.
cache_control: Option<CacheControlEphemeral>Create a cache control breakpoint at this content block.
Implementations§
Source§impl WebSearchToolResultBlock
impl WebSearchToolResultBlock
Sourcepub fn new<S: Into<String>>(
content: WebSearchToolResultBlockContent,
tool_use_id: S,
) -> Self
pub fn new<S: Into<String>>( content: WebSearchToolResultBlockContent, tool_use_id: S, ) -> Self
Creates a new WebSearchToolResultBlock.
Sourcepub fn new_with_results<S: Into<String>>(
results: Vec<WebSearchResultBlock>,
tool_use_id: S,
) -> Self
pub fn new_with_results<S: Into<String>>( results: Vec<WebSearchResultBlock>, tool_use_id: S, ) -> Self
Creates a new WebSearchToolResultBlock with results.
Sourcepub fn new_with_error<S: Into<String>>(
error: WebSearchToolResultError,
tool_use_id: S,
) -> Self
pub fn new_with_error<S: Into<String>>( error: WebSearchToolResultError, tool_use_id: S, ) -> Self
Creates a new WebSearchToolResultBlock with an error.
Sourcepub fn with_cache_control(self, cache_control: CacheControlEphemeral) -> Self
pub fn with_cache_control(self, cache_control: CacheControlEphemeral) -> Self
Add a cache control to this web search tool result block.
Sourcepub fn has_results(&self) -> bool
pub fn has_results(&self) -> bool
Returns true if the web search result contains successful results.
Sourcepub fn result_count(&self) -> usize
pub fn result_count(&self) -> usize
Returns the number of search results, or 0 if this is an error result.
Trait Implementations§
Source§impl Clone for WebSearchToolResultBlock
impl Clone for WebSearchToolResultBlock
Source§fn clone(&self) -> WebSearchToolResultBlock
fn clone(&self) -> WebSearchToolResultBlock
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WebSearchToolResultBlock
impl Debug for WebSearchToolResultBlock
Source§impl<'de> Deserialize<'de> for WebSearchToolResultBlock
impl<'de> Deserialize<'de> for WebSearchToolResultBlock
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<WebSearchToolResultBlock> for ContentBlock
impl From<WebSearchToolResultBlock> for ContentBlock
Source§fn from(block: WebSearchToolResultBlock) -> Self
fn from(block: WebSearchToolResultBlock) -> Self
Converts to this type from the input type.
Source§impl PartialEq for WebSearchToolResultBlock
impl PartialEq for WebSearchToolResultBlock
Source§fn eq(&self, other: &WebSearchToolResultBlock) -> bool
fn eq(&self, other: &WebSearchToolResultBlock) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for WebSearchToolResultBlock
impl Serialize for WebSearchToolResultBlock
impl StructuralPartialEq for WebSearchToolResultBlock
Auto Trait Implementations§
impl Freeze for WebSearchToolResultBlock
impl RefUnwindSafe for WebSearchToolResultBlock
impl Send for WebSearchToolResultBlock
impl Sync for WebSearchToolResultBlock
impl Unpin for WebSearchToolResultBlock
impl UnsafeUnpin for WebSearchToolResultBlock
impl UnwindSafe for WebSearchToolResultBlock
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