Abstract base class for creating callback handlers in the LangChain framework. It provides a set of optional methods that can be overridden in derived classes to handle various events during the execution of a LangChain application.
class BaseCallbackHandlerBaseCallbackHandlerMethodsClassA path to the module that contains the class, eg. ["langchain", "llms"] Usually should be the same as the entrypoint the class is exported from.
Called when an agent is about to execute an action, with the action and the run ID.
Called when an agent finishes execution, before it exits. with the final output and the run ID.
Called at the end of a Chain run, with the outputs and the run ID.
Called if a Chain run encounters an error
Called at the start of a Chain run, with the chain name and inputs and the run ID.
Called at the start of a Chat Model run, with the prompt(s) and the run ID.
Called at the end of an LLM/ChatModel run, with the output and the run ID.
Called if an LLM/ChatModel run encounters an error
Called when an LLM/ChatModel in streaming mode produces a new token
Called at the start of an LLM or Chat Model run, with the prompt(s) and the run ID.
Called at the end of a Tool run, with the tool output and the run ID.
Called if a Tool run encounters an error
Called at the start of a Tool run, with the tool name and input and the run ID.
The name of the serializable. Override to provide an alias or to preserve the serialized module name in minified environments.
Implemented as a static method to support loading logic.