#[non_exhaustive]pub enum Part {
Text {
text: String,
},
Image {
source: ImageSource,
},
Reasoning {
text: String,
raw: Value,
},
ToolCall {
id: String,
name: String,
arguments: Value,
signature: Option<String>,
},
ToolResult {
call_id: String,
content: String,
is_error: bool,
},
Other {
raw: Value,
},
}Expand description
One piece of a 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
Image
An image in a user message.
Fields
§
source: ImageSourceReasoning
Model reasoning (“thinking”). raw is the provider’s original block; it is sent back
unchanged on the next turn (Anthropic and Gemini require that) and skipped where the
provider does not accept it back. text may be empty when the provider hides reasoning.
ToolCall
Fields
ToolResult
Other
A provider block this crate does not model (e.g. Anthropic server-tool blocks or Gemini code-execution parts). Kept as received and sent back unchanged to the same provider.
Implementations§
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