pub trait CallbackHandler: Send + Sync {
Show 15 methods
// Provided methods
fn on_chain_start(&self, _runnable: &str, _input: &Value, _run_id: Uuid) { ... }
fn on_chain_end(&self, _runnable: &str, _output: &Value, _run_id: Uuid) { ... }
fn on_chain_error(&self, _runnable: &str, _error: &str, _run_id: Uuid) { ... }
fn on_llm_start(&self, _model: &str, _prompt: &Value, _run_id: Uuid) { ... }
fn on_llm_token(&self, _token: &str, _run_id: Uuid) { ... }
fn on_llm_end(&self, _model: &str, _output: &Value, _run_id: Uuid) { ... }
fn on_llm_error(&self, _model: &str, _error: &str, _run_id: Uuid) { ... }
fn on_tool_start(&self, _tool: &str, _args: &Value, _run_id: Uuid) { ... }
fn on_tool_end(&self, _tool: &str, _result: &Value, _run_id: Uuid) { ... }
fn on_tool_error(&self, _tool: &str, _error: &str, _run_id: Uuid) { ... }
fn on_node_start(&self, _node: &str, _step: u64, _run_id: Uuid) { ... }
fn on_node_end(
&self,
_node: &str,
_step: u64,
_output: &Value,
_run_id: Uuid,
) { ... }
fn on_checkpoint(&self, _step: u64, _run_id: Uuid) { ... }
fn on_custom(&self, _kind: &str, _payload: &Value, _run_id: Uuid) { ... }
fn name(&self) -> &str { ... }
}Expand description
Typed lifecycle callbacks. All methods have default no-op impls; implement only what you need.
Provided Methods§
Sourcefn on_chain_start(&self, _runnable: &str, _input: &Value, _run_id: Uuid)
fn on_chain_start(&self, _runnable: &str, _input: &Value, _run_id: Uuid)
A Runnable (chain / graph) started.
Sourcefn on_chain_end(&self, _runnable: &str, _output: &Value, _run_id: Uuid)
fn on_chain_end(&self, _runnable: &str, _output: &Value, _run_id: Uuid)
A Runnable finished successfully.
Sourcefn on_chain_error(&self, _runnable: &str, _error: &str, _run_id: Uuid)
fn on_chain_error(&self, _runnable: &str, _error: &str, _run_id: Uuid)
A Runnable errored.
Sourcefn on_llm_start(&self, _model: &str, _prompt: &Value, _run_id: Uuid)
fn on_llm_start(&self, _model: &str, _prompt: &Value, _run_id: Uuid)
LLM / chat-model invocation started.
Sourcefn on_llm_token(&self, _token: &str, _run_id: Uuid)
fn on_llm_token(&self, _token: &str, _run_id: Uuid)
LLM emitted a streamed token.
Sourcefn on_llm_end(&self, _model: &str, _output: &Value, _run_id: Uuid)
fn on_llm_end(&self, _model: &str, _output: &Value, _run_id: Uuid)
LLM finished a generation.
Sourcefn on_llm_error(&self, _model: &str, _error: &str, _run_id: Uuid)
fn on_llm_error(&self, _model: &str, _error: &str, _run_id: Uuid)
LLM errored.
Sourcefn on_tool_start(&self, _tool: &str, _args: &Value, _run_id: Uuid)
fn on_tool_start(&self, _tool: &str, _args: &Value, _run_id: Uuid)
Tool execution started.
Sourcefn on_tool_end(&self, _tool: &str, _result: &Value, _run_id: Uuid)
fn on_tool_end(&self, _tool: &str, _result: &Value, _run_id: Uuid)
Tool execution finished.
Sourcefn on_tool_error(&self, _tool: &str, _error: &str, _run_id: Uuid)
fn on_tool_error(&self, _tool: &str, _error: &str, _run_id: Uuid)
Tool errored.
Sourcefn on_node_start(&self, _node: &str, _step: u64, _run_id: Uuid)
fn on_node_start(&self, _node: &str, _step: u64, _run_id: Uuid)
Graph node started.
Sourcefn on_node_end(&self, _node: &str, _step: u64, _output: &Value, _run_id: Uuid)
fn on_node_end(&self, _node: &str, _step: u64, _output: &Value, _run_id: Uuid)
Graph node finished.
Sourcefn on_checkpoint(&self, _step: u64, _run_id: Uuid)
fn on_checkpoint(&self, _step: u64, _run_id: Uuid)
Graph engine persisted a checkpoint.