pub enum Part {
Text {
text: String,
provider_state: Option<ProviderState>,
},
Reasoning(Reasoning),
ImageUrl {
image_url: ImageUrl,
},
Image {
image: ImagePart,
},
ToolCall(ToolCall),
NativeToolCall(NativeToolCall),
ToolResult(ToolResult),
ProviderItem(ServerToolItem),
}Expand description
A piece of a message.
Variants§
Text
Plain text content.
Reasoning(Reasoning)
Model reasoning content.
ImageUrl
Image referenced by URL.
Image
Image passed inline as base64 data or a file reference.
ToolCall(ToolCall)
A tool call requested by the model.
NativeToolCall(NativeToolCall)
A Responses native client-tool call with its original identity and input.
ToolResult(ToolResult)
A tool result sent back to the model.
ProviderItem(ServerToolItem)
A provider-hosted tool item such as web-search output.
Implementations§
Source§impl Part
impl Part
Sourcepub fn text(text: impl Into<String>) -> Self
pub fn text(text: impl Into<String>) -> Self
Creates a plain Part::Text part.
Sourcepub fn text_with_provider_state(
text: impl Into<String>,
format: ProviderStateFormat,
data: Value,
) -> Self
pub fn text_with_provider_state( text: impl Into<String>, format: ProviderStateFormat, data: Value, ) -> Self
Creates a Part::Text part carrying provider-specific replay state.
Sourcepub fn reasoning(reasoning: Reasoning) -> Self
pub fn reasoning(reasoning: Reasoning) -> Self
Creates a Part::Reasoning part.
Sourcepub fn image_url(url: impl Into<String>) -> Self
pub fn image_url(url: impl Into<String>) -> Self
Creates a Part::ImageUrl part from a URL.
Sourcepub fn image(image: ImagePart) -> Self
pub fn image(image: ImagePart) -> Self
Creates a Part::Image part from an inline image source.
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
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 UnsafeUnpin 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