#[non_exhaustive]pub enum ContentPart {
Text {
text: String,
},
Image {
source: MediaSource,
},
Audio {
source: MediaSource,
},
Document {
source: MediaSource,
name: Option<String>,
},
ResourceLink {
uri: String,
name: String,
title: Option<String>,
description: Option<String>,
media_type: Option<String>,
size: Option<u64>,
},
ToolCall(ToolCall),
ToolResult(ToolResult),
Reasoning(ReasoningPart),
Refusal {
text: String,
},
Citation(Citation),
ProviderOpaque(ProviderData),
}Expand description
One ordered unit of model-visible content.
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
Plain text.
Image
Image content.
Fields
§
source: MediaSourceImage source.
Audio
Audio content.
Fields
§
source: MediaSourceAudio source.
Document
Document content.
ResourceLink
A link to a resource that may be fetched by an authorized host.
Fields
ToolCall(ToolCall)
A model-requested tool call.
ToolResult(ToolResult)
A tool result returned to a model.
Reasoning(ReasoningPart)
Provider reasoning or thinking data.
Refusal
A provider refusal.
Citation(Citation)
A citation associated with preceding or adjacent content.
ProviderOpaque(ProviderData)
Information that cannot yet be normalized without loss.
Implementations§
Trait Implementations§
Source§impl Clone for ContentPart
impl Clone for ContentPart
Source§fn clone(&self) -> ContentPart
fn clone(&self) -> ContentPart
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 ContentPart
impl Debug for ContentPart
Source§impl<'de> Deserialize<'de> for ContentPart
impl<'de> Deserialize<'de> for ContentPart
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 PartialEq for ContentPart
impl PartialEq for ContentPart
Source§impl Serialize for ContentPart
impl Serialize for ContentPart
impl StructuralPartialEq for ContentPart
Auto Trait Implementations§
impl Freeze for ContentPart
impl RefUnwindSafe for ContentPart
impl Send for ContentPart
impl Sync for ContentPart
impl Unpin for ContentPart
impl UnsafeUnpin for ContentPart
impl UnwindSafe for ContentPart
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