pub struct Turn {
pub id: String,
pub parent_id: Option<String>,
pub role: Role,
pub timestamp: String,
pub text: String,
pub thinking: Option<String>,
pub tool_uses: Vec<ToolInvocation>,
pub model: Option<String>,
pub stop_reason: Option<String>,
pub token_usage: Option<TokenUsage>,
pub extra: HashMap<String, Value>,
}Expand description
A single turn in a conversation, from any provider.
Fields§
§id: StringUnique identifier within the conversation.
parent_id: Option<String>Parent turn ID (for branching conversations).
role: RoleWho produced this turn.
timestamp: StringWhen this turn occurred (ISO 8601).
text: StringThe visible text content (already collapsed from provider-specific formats).
thinking: Option<String>Internal reasoning (chain-of-thought, thinking blocks).
tool_uses: Vec<ToolInvocation>Tool invocations in this turn.
model: Option<String>Model identifier (e.g. “claude-opus-4-6”, “gpt-4o”).
stop_reason: Option<String>Why the turn ended (e.g. “end_turn”, “tool_use”, “max_tokens”).
token_usage: Option<TokenUsage>Token usage for this turn.
extra: HashMap<String, Value>Provider-specific data that doesn’t fit the common schema.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Turn
impl<'de> Deserialize<'de> for Turn
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 Turn
impl RefUnwindSafe for Turn
impl Send for Turn
impl Sync for Turn
impl Unpin for Turn
impl UnsafeUnpin for Turn
impl UnwindSafe for Turn
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