pub struct Turn {
pub id: String,
pub status: TurnStatus,
pub items: Vec<Value>,
pub error: Option<Value>,
pub duration_ms: Option<i64>,
}Expand description
A turn, as reported in turn/start responses and turn/completed
notifications.
Fields§
§id: StringThe turn’s id, needed for AppServerHandle::turn_steer and
AppServerHandle::turn_interrupt.
status: TurnStatusThe turn’s status.
items: Vec<Value>The items the payload includes. Empty for a turn that was interrupted.
error: Option<Value>Why the turn failed. Only set when the status is
TurnStatus::Failed.
duration_ms: Option<i64>How long the turn ran, in milliseconds, once it has ended.
Implementations§
Source§impl Turn
impl Turn
Sourcepub fn final_message(&self) -> Option<&str>
pub fn final_message(&self) -> Option<&str>
The text of the turn’s final answer: the last agentMessage item in
items whose phase is final_answer.
Only newer servers put the answer in turn/completed (0.149.0 does,
0.145.0 sends no items), and an interrupted turn never has one. To get
the answer from any version, keep the last
Notification::agent_message whose
is_final_answer is true.
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
impl StructuralPartialEq for Turn
Auto Trait Implementations§
impl Forget for Turn
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