pub struct Hooks {
pub on_start: HookList<StartEvent>,
pub on_step_start: HookList<StepStartEvent>,
pub on_language_model_call_start: HookList<ModelCallStartEvent>,
pub on_language_model_call_end: HookList<ModelCallEndEvent>,
pub on_tool_execution_start: HookList<ToolExecutionStartEvent>,
pub on_tool_execution_end: HookList<ToolExecutionEndEvent>,
pub on_step_end: HookList<StepResult>,
pub on_end: HookList<EndEvent>,
pub on_chunk: HookList<StreamEvent>,
pub on_abort: HookList<AbortEvent>,
}Expand description
All lifecycle hooks of a call.
Fields§
§on_start: HookList<StartEvent>The call started.
on_step_start: HookList<StepStartEvent>A step started.
on_language_model_call_start: HookList<ModelCallStartEvent>A model call is about to be made.
on_language_model_call_end: HookList<ModelCallEndEvent>A model call finished (tool calls parsed, not yet executed).
on_tool_execution_start: HookList<ToolExecutionStartEvent>A tool execution started.
on_tool_execution_end: HookList<ToolExecutionEndEvent>A tool execution finished.
on_step_end: HookList<StepResult>A step finished.
on_end: HookList<EndEvent>The call finished.
on_chunk: HookList<StreamEvent>Streaming: a transformed event or a provider error entering retry handling.
on_abort: HookList<AbortEvent>Streaming: the call was aborted.
Implementations§
Source§impl Hooks
impl Hooks
Sourcepub fn merged(self, other: Hooks) -> Hooks
pub fn merged(self, other: Hooks) -> Hooks
Appends the hooks of other after those of self (settings-level
callbacks are invoked before call-level callbacks; their futures run
concurrently).
Sourcepub async fn emit<E: 'static>(list: &[Arc<dyn HookFn<E>>], event: Arc<E>)
pub async fn emit<E: 'static>(list: &[Arc<dyn HookFn<E>>], event: Arc<E>)
Invokes hooks in list order and awaits all returned futures concurrently.
Completion order is unspecified. Unwinding panics from invoking or
polling a callback are ignored after the normal panic handler runs.
This cannot isolate panics when compiled with panic = "abort".