Skip to main content

ChatOutcome

Enum ChatOutcome 

Source
pub enum ChatOutcome<T> {
    Complete(T),
    Paused {
        reason: PauseReason,
    },
}
Expand description

Result of a chat loop iteration. Returned by Chat::complete and Chat::resume.

The loop completes cleanly with Complete when the model has finished its response without leaving tools in a non-resolved state. It returns Paused when the loop stopped because one or more tools need the caller to act — for example, a human has to approve a pending call or a scheduled tool must wait for its wake-up time.

On Paused, the Messages argument that was passed in has been mutated in place — tool statuses reflect where each call stands. Callers resolve the pending tools by mutating their ToolStatus (typically via Messages::find_tool_mut) and then calling Chat::resume with the same Messages.

Variants§

§

Complete(T)

§

Paused

Fields

Implementations§

Source§

impl<T> ChatOutcome<T>

Source

pub fn into_complete(self) -> Result<T, PauseReason>

Convenience: extract the completed value, returning an error if the loop paused instead. Useful in flows that don’t expect pauses.

Source

pub fn expect_complete(self) -> T

Extract the completed value. Panics if the loop paused — use only in flows that don’t configure any pausing strategies (no Action::RequireApproval, no Action::Defer).

Source

pub fn is_complete(&self) -> bool

Trait Implementations§

Source§

impl<T> Debug for ChatOutcome<T>
where T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for ChatOutcome<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for ChatOutcome<T>
where T: RefUnwindSafe,

§

impl<T> Send for ChatOutcome<T>
where T: Send,

§

impl<T> Sync for ChatOutcome<T>
where T: Sync,

§

impl<T> Unpin for ChatOutcome<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for ChatOutcome<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for ChatOutcome<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<M> MetaArg<M> for M

Source§

fn into_meta(self) -> M

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.