#[non_exhaustive]pub enum AssistantPart {
Text(TextPart),
Custom(CustomPart),
File(FilePart),
Reasoning(ReasoningPart),
ReasoningFile(ReasoningFilePart),
ToolCall(ToolCallPart),
ToolResult(ToolResultPart),
ToolApprovalRequest(ToolApprovalRequest),
}Expand description
A part of an assistant 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.
Text(TextPart)
Text.
Custom(CustomPart)
Provider-specific content identified by kind.
File(FilePart)
A generated file.
Reasoning(ReasoningPart)
Reasoning text.
ReasoningFile(ReasoningFilePart)
A reasoning artefact.
ToolCall(ToolCallPart)
A tool call.
ToolResult(ToolResultPart)
A provider-executed tool result.
ToolApprovalRequest(ToolApprovalRequest)
A pending approval request.
Implementations§
Source§impl AssistantPart
impl AssistantPart
Sourcepub fn as_tool_call(&self) -> Option<&ToolCallPart>
pub fn as_tool_call(&self) -> Option<&ToolCallPart>
Returns the tool call when this is one.
Sourcepub fn as_tool_approval_request(&self) -> Option<&ToolApprovalRequest>
pub fn as_tool_approval_request(&self) -> Option<&ToolApprovalRequest>
Returns the approval request when this is one.
Trait Implementations§
Source§impl Clone for AssistantPart
impl Clone for AssistantPart
Source§fn clone(&self) -> AssistantPart
fn clone(&self) -> AssistantPart
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 AssistantPart
impl Debug for AssistantPart
Source§impl<'de> Deserialize<'de> for AssistantPart
impl<'de> Deserialize<'de> for AssistantPart
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<&str> for AssistantPart
impl From<&str> for AssistantPart
Source§impl From<CustomPart> for AssistantPart
impl From<CustomPart> for AssistantPart
Source§fn from(part: CustomPart) -> Self
fn from(part: CustomPart) -> Self
Converts to this type from the input type.
Source§impl From<FilePart> for AssistantPart
impl From<FilePart> for AssistantPart
Source§impl From<ReasoningFilePart> for AssistantPart
impl From<ReasoningFilePart> for AssistantPart
Source§fn from(part: ReasoningFilePart) -> Self
fn from(part: ReasoningFilePart) -> Self
Converts to this type from the input type.
Source§impl From<ReasoningPart> for AssistantPart
impl From<ReasoningPart> for AssistantPart
Source§fn from(part: ReasoningPart) -> Self
fn from(part: ReasoningPart) -> Self
Converts to this type from the input type.
Source§impl From<String> for AssistantPart
impl From<String> for AssistantPart
Source§impl From<TextPart> for AssistantPart
impl From<TextPart> for AssistantPart
Source§impl From<ToolApprovalRequest> for AssistantPart
impl From<ToolApprovalRequest> for AssistantPart
Source§fn from(part: ToolApprovalRequest) -> Self
fn from(part: ToolApprovalRequest) -> Self
Converts to this type from the input type.
Source§impl From<ToolCallPart> for AssistantPart
impl From<ToolCallPart> for AssistantPart
Source§fn from(part: ToolCallPart) -> Self
fn from(part: ToolCallPart) -> Self
Converts to this type from the input type.
Source§impl From<ToolResultPart> for AssistantPart
impl From<ToolResultPart> for AssistantPart
Source§fn from(part: ToolResultPart) -> Self
fn from(part: ToolResultPart) -> Self
Converts to this type from the input type.
Source§impl PartialEq for AssistantPart
impl PartialEq for AssistantPart
Source§impl Serialize for AssistantPart
impl Serialize for AssistantPart
impl StructuralPartialEq for AssistantPart
Auto Trait Implementations§
impl !Freeze for AssistantPart
impl RefUnwindSafe for AssistantPart
impl Send for AssistantPart
impl Sync for AssistantPart
impl Unpin for AssistantPart
impl UnsafeUnpin for AssistantPart
impl UnwindSafe for AssistantPart
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