#[non_exhaustive]pub enum ToolPart {
ToolResult(ToolResultPart),
ToolApprovalResponse(ToolApprovalResponse),
}Expand description
A part of a tool message.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
ToolResult(ToolResultPart)
A client-side tool result.
ToolApprovalResponse(ToolApprovalResponse)
An approval response; stripped before the prompt reaches the model.
Implementations§
Source§impl ToolPart
impl ToolPart
Sourcepub fn as_tool_result(&self) -> Option<&ToolResultPart>
pub fn as_tool_result(&self) -> Option<&ToolResultPart>
Returns the tool result when this is one.
Sourcepub fn as_tool_approval_response(&self) -> Option<&ToolApprovalResponse>
pub fn as_tool_approval_response(&self) -> Option<&ToolApprovalResponse>
Returns the approval response when this is one.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ToolPart
impl<'de> Deserialize<'de> for ToolPart
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<ToolApprovalResponse> for ToolPart
impl From<ToolApprovalResponse> for ToolPart
Source§fn from(part: ToolApprovalResponse) -> Self
fn from(part: ToolApprovalResponse) -> Self
Converts to this type from the input type.
Source§impl From<ToolResultPart> for ToolPart
impl From<ToolResultPart> for ToolPart
Source§fn from(part: ToolResultPart) -> Self
fn from(part: ToolResultPart) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for ToolPart
Auto Trait Implementations§
impl Freeze for ToolPart
impl RefUnwindSafe for ToolPart
impl Send for ToolPart
impl Sync for ToolPart
impl Unpin for ToolPart
impl UnsafeUnpin for ToolPart
impl UnwindSafe for ToolPart
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