pub enum Part {
Text(TextPart),
Media(MediaPart),
File(FilePart),
Structured(StructuredPart),
Reasoning(ReasoningPart),
ToolCall(ToolCallPart),
ToolResult(ToolResultPart),
Custom(CustomPart),
}Expand description
A content part within an Item.
Items are composed of one or more parts, each carrying a different kind of content – plain text, images, files, tool calls, tool results, or provider-specific custom payloads.
§Example
use agentkit_core::{Part, ToolCallPart};
use serde_json::json;
let parts: Vec<Part> = vec![
Part::text("Reading the config file..."),
Part::ToolCall(ToolCallPart::new(
"call-42",
"fs.read_file",
json!({ "path": "config.toml" }),
)),
];
assert!(matches!(parts[0], Part::Text(_)));
assert!(matches!(parts[1], Part::ToolCall(_)));Variants§
Text(TextPart)
Plain text content.
Media(MediaPart)
Binary or encoded media (images, audio, video).
File(FilePart)
A file attachment.
Structured(StructuredPart)
Structured JSON data, optionally validated against a schema.
Reasoning(ReasoningPart)
Model reasoning / chain-of-thought output.
ToolCall(ToolCallPart)
A tool invocation request emitted by the model.
ToolResult(ToolResultPart)
The result returned by a tool after execution.
Custom(CustomPart)
A provider-specific part that does not fit the standard variants.
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