pub struct Callbacks {
pub before_model: Vec<BeforeModelCallback>,
pub after_model: Vec<AfterModelCallback>,
pub before_tool: Vec<BeforeToolCallback>,
pub after_tool: Vec<AfterToolCallback>,
}Expand description
Collection of all callback types
Fields§
§before_model: Vec<BeforeModelCallback>§after_model: Vec<AfterModelCallback>§before_tool: Vec<BeforeToolCallback>§after_tool: Vec<AfterToolCallback>Implementations§
Source§impl Callbacks
impl Callbacks
pub fn new() -> Self
pub fn add_before_model(&mut self, callback: BeforeModelCallback)
pub fn add_after_model(&mut self, callback: AfterModelCallback)
pub fn add_before_tool(&mut self, callback: BeforeToolCallback)
pub fn add_after_tool(&mut self, callback: AfterToolCallback)
Sourcepub async fn execute_before_model(
&self,
ctx: Arc<dyn CallbackContext>,
) -> Result<Vec<Content>>
pub async fn execute_before_model( &self, ctx: Arc<dyn CallbackContext>, ) -> Result<Vec<Content>>
Execute all before_model callbacks
Sourcepub async fn execute_after_model(
&self,
ctx: Arc<dyn CallbackContext>,
) -> Result<Vec<Content>>
pub async fn execute_after_model( &self, ctx: Arc<dyn CallbackContext>, ) -> Result<Vec<Content>>
Execute all after_model callbacks
Sourcepub async fn execute_before_tool(
&self,
ctx: Arc<dyn CallbackContext>,
) -> Result<Vec<Content>>
pub async fn execute_before_tool( &self, ctx: Arc<dyn CallbackContext>, ) -> Result<Vec<Content>>
Execute all before_tool callbacks
Sourcepub async fn execute_after_tool(
&self,
ctx: Arc<dyn CallbackContext>,
) -> Result<Vec<Content>>
pub async fn execute_after_tool( &self, ctx: Arc<dyn CallbackContext>, ) -> Result<Vec<Content>>
Execute all after_tool callbacks