pub enum Part {
    Text(TextPart),
    Image(ImagePart),
    Audio(AudioPart),
    Source(SourcePart),
    ToolCall(ToolCallPart),
    ToolResult(ToolResultPart),
    Reasoning(ReasoningPart),
}Expand description
A part of the message.
Variants§
Text(TextPart)
Image(ImagePart)
Audio(AudioPart)
Source(SourcePart)
ToolCall(ToolCallPart)
ToolResult(ToolResultPart)
Reasoning(ReasoningPart)
Implementations§
Source§impl Part
 
impl Part
pub fn text(text: impl Into<String>) -> Self
pub fn image(data: impl Into<String>, mime_type: impl Into<String>) -> Self
pub fn audio(data: impl Into<String>, format: AudioFormat) -> Self
pub fn source( source: impl Into<String>, title: impl Into<String>, content: Vec<Self>, ) -> Self
pub fn reasoning(text: impl Into<String>) -> Self
pub fn tool_call( tool_call_id: impl Into<String>, tool_name: impl Into<String>, args: Value, ) -> Self
pub fn tool_result( tool_call_id: impl Into<String>, tool_name: impl Into<String>, content: Vec<Self>, ) -> Self
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Part
 
impl<'de> Deserialize<'de> for Part
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<ReasoningPart> for Part
 
impl From<ReasoningPart> for Part
Source§fn from(value: ReasoningPart) -> Self
 
fn from(value: ReasoningPart) -> Self
Converts to this type from the input type.
Source§impl From<SourcePart> for Part
 
impl From<SourcePart> for Part
Source§fn from(value: SourcePart) -> Self
 
fn from(value: SourcePart) -> Self
Converts to this type from the input type.
Source§impl From<ToolCallPart> for Part
 
impl From<ToolCallPart> for Part
Source§fn from(value: ToolCallPart) -> Self
 
fn from(value: ToolCallPart) -> Self
Converts to this type from the input type.
Source§impl From<ToolResultPart> for Part
 
impl From<ToolResultPart> for Part
Source§fn from(value: ToolResultPart) -> Self
 
fn from(value: ToolResultPart) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for Part
Auto Trait Implementations§
impl Freeze for Part
impl RefUnwindSafe for Part
impl Send for Part
impl Sync for Part
impl Unpin for Part
impl UnwindSafe for Part
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