pub struct TextTurnState<T: Toolset> {
pub request_id: Option<String>,
pub model: String,
pub assistant_turn: Vec<AssistantTurnItem>,
pub tool_calls: Vec<T::ToolCall>,
pub finish_reason: Option<FinishReason>,
pub usage: Option<Usage>,
pub committed_turn: Option<CommittedTurn>,
}Fields§
§request_id: Option<String>§model: String§assistant_turn: Vec<AssistantTurnItem>§tool_calls: Vec<T::ToolCall>§finish_reason: Option<FinishReason>§usage: Option<Usage>§committed_turn: Option<CommittedTurn>Implementations§
Source§impl<T> TextTurnState<T>where
T: Toolset,
impl<T> TextTurnState<T>where
T: Toolset,
pub fn assistant_text(&self) -> String
Sourcepub fn apply(
&mut self,
event: &TextTurnEvent<T>,
) -> Result<(), TextTurnReductionError>
pub fn apply( &mut self, event: &TextTurnEvent<T>, ) -> Result<(), TextTurnReductionError>
Apply a streaming event to advance this turn state.
Returns an error if the turn has already completed.
Sourcepub fn finish(self) -> Result<TextTurnResult<T>, TextTurnReductionError>
pub fn finish(self) -> Result<TextTurnResult<T>, TextTurnReductionError>
Finalize the accumulated state into a completed turn result.
Returns TextTurnReductionError::Incomplete if the turn has not yet
received a Completed event, and
TextTurnReductionError::EmptyAssistantOutput if the completed turn
produced no assistant items.
Trait Implementations§
Source§impl<T> Clone for TextTurnState<T>where
T: Toolset,
impl<T> Clone for TextTurnState<T>where
T: Toolset,
Source§impl<T> Default for TextTurnState<T>where
T: Toolset,
impl<T> Default for TextTurnState<T>where
T: Toolset,
Source§impl<T> PartialEq for TextTurnState<T>
impl<T> PartialEq for TextTurnState<T>
impl<T> Eq for TextTurnState<T>
Auto Trait Implementations§
impl<T> Freeze for TextTurnState<T>
impl<T> !RefUnwindSafe for TextTurnState<T>
impl<T> Send for TextTurnState<T>
impl<T> Sync for TextTurnState<T>
impl<T> Unpin for TextTurnState<T>
impl<T> UnsafeUnpin for TextTurnState<T>
impl<T> !UnwindSafe for TextTurnState<T>
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