pub enum Msg {
System {
text: String,
ts: u64,
},
User {
text: String,
principal: Option<String>,
ts: u64,
},
Assistant {
text: Option<String>,
tool_calls: Vec<ToolCall>,
ts: u64,
},
Tool {
id: String,
name: String,
content: Value,
is_error: bool,
ts: u64,
},
Note {
text: String,
ts: u64,
},
}Expand description
One transcript entry. ts is wall-clock ms; tool results keep the parsed
JSON when the tool returned structured content (text otherwise).
Variants§
System
User
Assistant
Tool
Note
A runtime note (a run finished, a subagent reported, an instruction changed…) — rendered to the model as a system message.
Implementations§
Source§impl Msg
impl Msg
pub fn system(text: impl Into<String>) -> Msg
pub fn user(text: impl Into<String>, principal: Option<String>) -> Msg
pub fn assistant(text: Option<String>, tool_calls: Vec<ToolCall>) -> Msg
pub fn tool( id: impl Into<String>, name: impl Into<String>, content: Value, is_error: bool, ) -> Msg
pub fn note(text: impl Into<String>) -> Msg
pub fn ts(&self) -> u64
Sourcepub fn est_tokens(&self) -> u64
pub fn est_tokens(&self) -> u64
A rough token estimate for this message.
pub fn is_user(&self) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Msg
impl<'de> Deserialize<'de> for Msg
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 Msg
Auto Trait Implementations§
impl Freeze for Msg
impl RefUnwindSafe for Msg
impl Send for Msg
impl Sync for Msg
impl Unpin for Msg
impl UnsafeUnpin for Msg
impl UnwindSafe for Msg
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