pub struct PartialStreamedTurn {
pub head: AssistantMessage,
pub content: Vec<AssistantContent>,
pub pending_tool_calls: Vec<ToolCall>,
}Expand description
Snapshot of a streamed turn at the moment an invalid tool call appeared. Used by the machine to build diagnostics and rollback messages from exactly what the model has produced so far.
Fields§
§head: AssistantMessageThe turn the reply began, with no content: its origin, so a rolled back turn is known to come from its model. A reply cut before its end keeps no provider item, so the rolled back turn replays canonically.
content: Vec<AssistantContent>The parts that arrived so far, in the order they started, text still streaming included.
pending_tool_calls: Vec<ToolCall>Tool calls already validated (or repaired) this turn.
Implementations§
Source§impl PartialStreamedTurn
impl PartialStreamedTurn
Sourcepub fn assistant_message(
&self,
current_tool_call: Option<ToolCall>,
) -> Option<Message>
pub fn assistant_message( &self, current_tool_call: Option<ToolCall>, ) -> Option<Message>
The assistant message representing this partial turn, in arrival
order: each validated call as validated, current_tool_call in its
own place, and any other call left out. A call keeps a provider item
only where the partial reply kept it, which a reply cut before its
end never does. None when the turn has produced no representable
content.
Sourcepub fn rollback_messages(
&self,
invalid_tool_call: ToolCall,
feedback: String,
) -> [Message; 2]
pub fn rollback_messages( &self, invalid_tool_call: ToolCall, feedback: String, ) -> [Message; 2]
Rollback messages for a retried or skipped streamed turn: the partial
assistant turn plus a user message carrying feedback for the invalid
call and a synthetic “not executed” result for each validated peer.