pub struct BaseCallbackManager {
pub handlers: Vec<Arc<dyn BaseCallbackHandler>>,
pub inheritable_handlers: Vec<Arc<dyn BaseCallbackHandler>>,
pub parent_run_id: Option<Uuid>,
pub tags: Vec<String>,
pub inheritable_tags: Vec<String>,
pub metadata: HashMap<String, Value>,
pub inheritable_metadata: HashMap<String, Value>,
}Expand description
Base callback manager for LangChain.
Manages a collection of callback handlers and provides methods to add, remove, and configure handlers.
Fields§
§handlers: Vec<Arc<dyn BaseCallbackHandler>>The handlers.
inheritable_handlers: Vec<Arc<dyn BaseCallbackHandler>>The inheritable handlers.
parent_run_id: Option<Uuid>The parent run ID.
The tags.
The inheritable tags.
metadata: HashMap<String, Value>The metadata.
inheritable_metadata: HashMap<String, Value>The inheritable metadata.
Implementations§
Source§impl BaseCallbackManager
impl BaseCallbackManager
Sourcepub fn with_handlers(
handlers: Vec<Arc<dyn BaseCallbackHandler>>,
inheritable_handlers: Option<Vec<Arc<dyn BaseCallbackHandler>>>,
parent_run_id: Option<Uuid>,
tags: Option<Vec<String>>,
inheritable_tags: Option<Vec<String>>,
metadata: Option<HashMap<String, Value>>,
inheritable_metadata: Option<HashMap<String, Value>>,
) -> Self
pub fn with_handlers( handlers: Vec<Arc<dyn BaseCallbackHandler>>, inheritable_handlers: Option<Vec<Arc<dyn BaseCallbackHandler>>>, parent_run_id: Option<Uuid>, tags: Option<Vec<String>>, inheritable_tags: Option<Vec<String>>, metadata: Option<HashMap<String, Value>>, inheritable_metadata: Option<HashMap<String, Value>>, ) -> Self
Create a new callback manager with handlers.
This matches the Python __init__ signature.
Sourcepub fn merge(&self, other: &BaseCallbackManager) -> Self
pub fn merge(&self, other: &BaseCallbackManager) -> Self
Merge with another callback manager.
Note: This matches Python’s behavior which does NOT merge inheritable_metadata (this appears to be a bug in the Python implementation, but we match it for compatibility).
Sourcepub fn add_handler(
&mut self,
handler: Arc<dyn BaseCallbackHandler>,
inherit: bool,
)
pub fn add_handler( &mut self, handler: Arc<dyn BaseCallbackHandler>, inherit: bool, )
Add a handler to the callback manager.
Sourcepub fn remove_handler(&mut self, handler: &Arc<dyn BaseCallbackHandler>)
pub fn remove_handler(&mut self, handler: &Arc<dyn BaseCallbackHandler>)
Remove a handler from the callback manager.
Sourcepub fn set_handlers(
&mut self,
handlers: Vec<Arc<dyn BaseCallbackHandler>>,
inherit: bool,
)
pub fn set_handlers( &mut self, handlers: Vec<Arc<dyn BaseCallbackHandler>>, inherit: bool, )
Set handlers as the only handlers on the callback manager.
Sourcepub fn set_handler(
&mut self,
handler: Arc<dyn BaseCallbackHandler>,
inherit: bool,
)
pub fn set_handler( &mut self, handler: Arc<dyn BaseCallbackHandler>, inherit: bool, )
Set a single handler as the only handler on the callback manager.
Add tags to the callback manager.
Remove tags from the callback manager.
Sourcepub fn add_metadata(&mut self, metadata: HashMap<String, Value>, inherit: bool)
pub fn add_metadata(&mut self, metadata: HashMap<String, Value>, inherit: bool)
Add metadata to the callback manager.
Sourcepub fn remove_metadata(&mut self, keys: Vec<String>)
pub fn remove_metadata(&mut self, keys: Vec<String>)
Remove metadata from the callback manager.
Trait Implementations§
Source§impl Clone for BaseCallbackManager
impl Clone for BaseCallbackManager
Source§fn clone(&self) -> BaseCallbackManager
fn clone(&self) -> BaseCallbackManager
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more