pub struct LoggingHook { /* private fields */ }Expand description
Implementations§
Source§impl LoggingHook
impl LoggingHook
Sourcepub fn with_tokens() -> Self
pub fn with_tokens() -> Self
Creates a LoggingHook that also logs stream tokens.
Sourcepub fn with_log_tokens(self, log: bool) -> Self
pub fn with_log_tokens(self, log: bool) -> Self
Sets whether to log stream tokens.
Trait Implementations§
Source§impl AgentHook for LoggingHook
impl AgentHook for LoggingHook
Source§fn on_before_completion(&self, ctx: &mut CompletionContext) -> CompletionAction
fn on_before_completion(&self, ctx: &mut CompletionContext) -> CompletionAction
Called before an LLM completion. Can modify messages or reject the call.
Source§fn on_after_completion(
&self,
ctx: &mut CompletionResult,
) -> Result<(), HookError>
fn on_after_completion( &self, ctx: &mut CompletionResult, ) -> Result<(), HookError>
Called after an LLM completion. Can modify the response.
Source§fn on_before_tool_call(&self, ctx: &mut ToolCallContext) -> ToolCallAction
fn on_before_tool_call(&self, ctx: &mut ToolCallContext) -> ToolCallAction
Called before a tool call. Can approve, reject, modify, or skip.
Source§fn on_after_tool_call(
&self,
ctx: &mut ToolResultContext,
) -> Result<(), HookError>
fn on_after_tool_call( &self, ctx: &mut ToolResultContext, ) -> Result<(), HookError>
Called after a tool call. Can modify the result.
Source§fn on_stream_chunk(&self, chunk: &str) -> StreamAction
fn on_stream_chunk(&self, chunk: &str) -> StreamAction
Called for each streaming token. Can filter, replace, or forward.
Source§fn on_agent_start(&self, input: &str) -> Result<(), HookError>
fn on_agent_start(&self, input: &str) -> Result<(), HookError>
Called when the agent starts execution.
Source§fn on_agent_end(&self, output: &str) -> Result<(), HookError>
fn on_agent_end(&self, output: &str) -> Result<(), HookError>
Called when the agent finishes execution.
Source§fn on_error(&self, error: &HookError) -> ErrorAction
fn on_error(&self, error: &HookError) -> ErrorAction
Called when an error occurs. Can retry, ignore, or propagate.
Auto Trait Implementations§
impl Freeze for LoggingHook
impl RefUnwindSafe for LoggingHook
impl Send for LoggingHook
impl Sync for LoggingHook
impl Unpin for LoggingHook
impl UnsafeUnpin for LoggingHook
impl UnwindSafe for LoggingHook
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