#[non_exhaustive]pub struct ModelMessageEvent<'a> { /* private fields */ }Expand description
The model finished a message (ModelMessageEvent).
Implementations§
Source§impl<'a> ModelMessageEvent<'a>
impl<'a> ModelMessageEvent<'a>
Sourcepub fn agent(&self) -> &LocalAgent
pub fn agent(&self) -> &LocalAgent
The agent.
Sourcepub fn agent_mut(&mut self) -> &mut LocalAgent
pub fn agent_mut(&mut self) -> &mut LocalAgent
The agent, mutably: hooks may change its messages, system prompt, tools and state.
Sourcepub fn invocation_state(&self) -> &InvocationState
pub fn invocation_state(&self) -> &InvocationState
The caller’s per-invocation state.
Sourcepub fn invocation_context(&self) -> Option<&InvocationContext>
pub fn invocation_context(&self) -> Option<&InvocationContext>
The request this event belongs to.
Source§impl<'a> ModelMessageEvent<'a>
impl<'a> ModelMessageEvent<'a>
Sourcepub fn stop_reason(&self) -> StopReason
pub fn stop_reason(&self) -> StopReason
Why the model stopped.
Trait Implementations§
Source§impl Debug for ModelMessageEvent<'_>
impl Debug for ModelMessageEvent<'_>
Source§impl From<&ModelMessageEvent<'_>> for ModelMessageEventData
impl From<&ModelMessageEvent<'_>> for ModelMessageEventData
Source§fn from(event: &ModelMessageEvent<'_>) -> Self
fn from(event: &ModelMessageEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl From<&ModelMessageEvent<'_>> for AgentStreamEvent
impl From<&ModelMessageEvent<'_>> for AgentStreamEvent
Source§fn from(event: &ModelMessageEvent<'_>) -> Self
fn from(event: &ModelMessageEvent<'_>) -> Self
Converts to this type from the input type.
Source§impl HookEvent for ModelMessageEvent<'static>
impl HookEvent for ModelMessageEvent<'static>
Source§type Event<'a> = ModelMessageEvent<'a>
type Event<'a> = ModelMessageEvent<'a>
The event type for an agent borrow of lifetime
'a.impl<H> IntoHookImpl<ModelMessageEvent<'static>> for Hwhere
H: for<'a> Hook<ModelMessageEvent<'a>>,
impl<F, R> IntoSyncHook<ModelMessageEvent<'static>> for F
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for ModelMessageEvent<'a>
impl<'a> !UnwindSafe for ModelMessageEvent<'a>
impl<'a> Forget for ModelMessageEvent<'a>
impl<'a> Freeze for ModelMessageEvent<'a>where
&'a mut LocalAgent: Freeze,
*const ArcInner<RwLock<Extensions>> is !null: Freeze,
PhantomData<ArcInner<RwLock<Extensions>>>: Freeze,
*const ArcInner<Inner> is !null: Freeze,
PhantomData<ArcInner<Inner>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<ContentBlock>: Freeze,
PhantomData<u8>: Freeze,
PhantomData<usize>: Freeze,
PhantomData<Bucket<String, Value>>: Freeze,
impl<'a> Move for ModelMessageEvent<'a>
impl<'a> Send for ModelMessageEvent<'a>where
RawVecInner: Send,
OnceLock<String>: Send,
Arc<RwLock<Map<String, Value>>>: Send,
RawTable<usize>: Send,
Arc<dyn Error + Send + Sync>: Send,
Arc<dyn Model>: Send,
Arc<dyn Tool>: Send,
Arc<Shared>: Send,
Arc<[Source]>: Send,
Arc<Mutex<Meter>>: Send,
Arc<Tracer>: Send,
Arc<HookRegistry>: Send,
Arc<MiddlewareRegistry>: Send,
Arc<Mutex<InterruptStateData>>: Send,
Arc<BackgroundTasks>: Send,
Arc<dyn Sandbox>: Send,
Arc<dyn Storage>: Send,
Arc<[Arc<dyn ContextStrategy>]>: Send,
Arc<Mutex<Option<AgentArchive>>>: Send,
Arc<Inner>: Send,
Arc<Mutex<Option<CallTools>>>: Send,
Arc<[Arc<dyn InterventionHandler>]>: Send,
Arc<RwLock<Extensions>>: Send,
Arc<Inner>: Send,
impl<'a> Sync for ModelMessageEvent<'a>where
RawVecInner: Sync,
OnceLock<String>: Sync,
Arc<RwLock<Map<String, Value>>>: Sync,
RawTable<usize>: Sync,
Arc<dyn Error + Send + Sync>: Sync,
Arc<dyn Model>: Sync,
Arc<dyn Tool>: Sync,
Arc<Shared>: Sync,
Arc<[Source]>: Sync,
Arc<Mutex<Meter>>: Sync,
Arc<Tracer>: Sync,
Arc<HookRegistry>: Sync,
Arc<MiddlewareRegistry>: Sync,
Arc<Mutex<InterruptStateData>>: Sync,
Arc<BackgroundTasks>: Sync,
Arc<dyn Sandbox>: Sync,
Arc<dyn Storage>: Sync,
Arc<[Arc<dyn ContextStrategy>]>: Sync,
Arc<Mutex<Option<AgentArchive>>>: Sync,
Arc<Inner>: Sync,
Arc<Mutex<Option<CallTools>>>: Sync,
Arc<[Arc<dyn InterventionHandler>]>: Sync,
Arc<RwLock<Extensions>>: Sync,
Arc<Inner>: Sync,
impl<'a> Unpin for ModelMessageEvent<'a>
impl<'a> UnsafeUnpin for ModelMessageEvent<'a>where
&'a mut LocalAgent: UnsafeUnpin,
*const ArcInner<RwLock<Extensions>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<Extensions>>>: UnsafeUnpin,
*const ArcInner<Inner> is !null: UnsafeUnpin,
PhantomData<ArcInner<Inner>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<ContentBlock>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
PhantomData<Bucket<String, Value>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.