pub struct HookContext {
pub point: HookPoint,
pub name: Option<String>,
pub input: Option<Value>,
pub output: Option<Value>,
pub error: Option<String>,
pub session_id: Option<String>,
}Expand description
Context passed to hooks.
Fields§
§point: HookPointThe hook point being triggered.
name: Option<String>Name of the relevant tool/provider (if applicable).
input: Option<Value>Input data (tool args, LLM prompt, etc.).
output: Option<Value>Output data (tool result, LLM response, etc.).
error: Option<String>Error message (for OnError).
session_id: Option<String>Session ID.
Implementations§
Source§impl HookContext
impl HookContext
Sourcepub fn tool(point: HookPoint, name: &str, args: Value) -> Self
pub fn tool(point: HookPoint, name: &str, args: Value) -> Self
Create a context for a tool execution hook.
Sourcepub fn llm(point: HookPoint, provider: &str, data: Value) -> Self
pub fn llm(point: HookPoint, provider: &str, data: Value) -> Self
Create a context for an LLM request/response hook.
Trait Implementations§
Source§impl Clone for HookContext
impl Clone for HookContext
Source§fn clone(&self) -> HookContext
fn clone(&self) -> HookContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HookContext
impl Debug for HookContext
Source§impl<'de> Deserialize<'de> for HookContext
impl<'de> Deserialize<'de> for HookContext
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
Auto Trait Implementations§
impl Freeze for HookContext
impl RefUnwindSafe for HookContext
impl Send for HookContext
impl Sync for HookContext
impl Unpin for HookContext
impl UnsafeUnpin for HookContext
impl UnwindSafe for HookContext
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