pub struct Item {
pub id: Option<MessageId>,
pub kind: ItemKind,
pub parts: Vec<Part>,
pub metadata: BTreeMap<String, Value>,
}Expand description
A single entry in the agent transcript.
An Item represents one message or event in the conversation between
the system, user, assistant, and tools. Each item has a kind
that determines its role and a vector of Parts that carry its content.
Items are the primary unit of data flowing through the agentkit loop:
callers submit user and system items, the loop appends assistant and tool
items, and compaction strategies operate on the full Vec<Item> transcript.
§Example
use agentkit_core::{Item, ItemKind};
let user_msg = Item::text(ItemKind::User, "List the workspace crates.");
assert_eq!(user_msg.kind, ItemKind::User);
assert_eq!(user_msg.parts.len(), 1);Fields§
§id: Option<MessageId>Optional provider-assigned or user-supplied message identifier.
kind: ItemKindThe role of this item in the transcript.
parts: Vec<Part>The content parts that make up this item.
metadata: BTreeMap<String, Value>Arbitrary key-value metadata for this item.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Item
impl<'de> Deserialize<'de> for Item
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Item, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Item, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for Item
impl Serialize for Item
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Item
Auto Trait Implementations§
impl Freeze for Item
impl RefUnwindSafe for Item
impl Send for Item
impl Sync for Item
impl Unpin for Item
impl UnsafeUnpin for Item
impl UnwindSafe for Item
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