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
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Callbacks
impl !RefUnwindSafe for Callbacks
impl Send for Callbacks
impl Sync for Callbacks
impl Unpin for Callbacks
impl !UnwindSafe for Callbacks
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