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§
Implementations§
Source§impl<T> ChatOutcome<T>
impl<T> ChatOutcome<T>
Sourcepub fn into_complete(self) -> Result<T, PauseReason>
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.
Sourcepub fn expect_complete(self) -> T
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).