pub struct Session {
pub path: PathBuf,
pub format: String,
pub metadata: SessionMetadata,
pub turns: Vec<Turn>,
}Expand description
A parsed session in unified format.
Fields§
§path: PathBufPath to the original session file.
format: StringName of the format that parsed this session.
metadata: SessionMetadataSession metadata (IDs, timestamps, provider info).
turns: Vec<Turn>Conversation turns (request/response pairs).
Implementations§
Source§impl Session
impl Session
Sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Total number of messages across all turns.
Sourcepub fn messages_by_role(&self, role: Role) -> usize
pub fn messages_by_role(&self, role: Role) -> usize
Count messages by role.
Sourcepub fn tool_uses(&self) -> impl Iterator<Item = (&str, &Value)>
pub fn tool_uses(&self) -> impl Iterator<Item = (&str, &Value)>
Iterate over all tool use blocks.
Sourcepub fn tool_results(&self) -> impl Iterator<Item = (&str, bool)>
pub fn tool_results(&self) -> impl Iterator<Item = (&str, bool)>
Iterate over all tool results.
Sourcepub fn total_tokens(&self) -> TokenUsage
pub fn total_tokens(&self) -> TokenUsage
Total token usage across all turns.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Session
impl<'de> Deserialize<'de> for Session
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
Auto Trait Implementations§
impl Freeze for Session
impl RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnwindSafe for Session
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